Package com.helger.css.media
Class CSSMediaList
java.lang.Object
com.helger.css.media.CSSMediaList
- All Implemented Interfaces:
com.helger.commons.lang.ICloneable<CSSMediaList>,ICSSMediaList
@NotThreadSafe
public class CSSMediaList
extends Object
implements ICSSMediaList, com.helger.commons.lang.ICloneable<CSSMediaList>
Manages an ordered set of
ECSSMedium objects.- Author:
- Philip Helger
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructorCSSMediaList(CSSMediaList aOther) Copy constructor.CSSMediaList(ECSSMedium eMedium) Constructor with a single mediumCSSMediaList(ECSSMedium... aMedia) Constructor with an array of media.CSSMediaList(ICSSMediaList aOther) Constructor using another media list.CSSMediaList(Iterable<ECSSMedium> aMedia) Constructor with a collection of media. -
Method Summary
Modifier and TypeMethodDescriptionaddMedia(ECSSMedium... aMediaList) Add a media list to the listaddMedia(ICSSMediaList aMediaList) Add a media list to the listaddMedia(Iterable<ECSSMedium> aMediaList) Add a media list to the listaddMedium(ECSSMedium eMedium) Add a new medium to the listbooleancontainsMedium(ECSSMedium eMedium) Check if the passed medium is explicitly specifiedstatic CSSMediaListcreateOnDemand(ICSSMediaList aMediaList) booleancom.helger.commons.collection.impl.ICommonsOrderedSet<ECSSMedium>getClone()intgetMediaString(String sSeparator) inthashCode()booleancom.helger.commons.state.EChangeRemove all media.com.helger.commons.state.EChangeremoveMedium(ECSSMedium eMedium) Remove the passed mediumtoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.css.media.ICSSMediaList
containsMediumOrAll, getMediaString, hasAnyMedia, hasNoMediaOrAll, isForScreen
-
Field Details
-
DEFAULT_MEDIA_STRING_SEPARATOR
- See Also:
-
-
Constructor Details
-
CSSMediaList
public CSSMediaList()Constructor -
CSSMediaList
Constructor with a single medium- Parameters:
eMedium- The medium to be added. May not benull.
-
CSSMediaList
Constructor with an array of media.- Parameters:
aMedia- The array of media to be added. The array may benullbut it may not containnullelements.
-
CSSMediaList
Constructor with a collection of media.- Parameters:
aMedia- The collection of media to be added. The collection may benullbut it may not containnullelements.
-
CSSMediaList
Constructor using another media list.- Parameters:
aOther- The object to copy from. May not benull.- Since:
- 3.8.3
-
CSSMediaList
Copy constructor.- Parameters:
aOther- The object to copy from. May not benull.
-
-
Method Details
-
addMedium
Add a new medium to the list- Parameters:
eMedium- The medium to be added. May not benull.- Returns:
this
-
addMedia
Add a media list to the list- Parameters:
aMediaList- The media list to be added. May not benull.- Returns:
this- Since:
- 3.8.3
-
addMedia
Add a media list to the list- Parameters:
aMediaList- The media list to be added. May not benull.- Returns:
this- Since:
- 3.8.3
-
addMedia
Add a media list to the list- Parameters:
aMediaList- The media list to be added. May not benull.- Returns:
this- Since:
- 3.8.3
-
removeMedium
Remove the passed medium- Parameters:
eMedium- The medium to be removed. May benull.- Returns:
EChange.CHANGEDif the medium was removed,EChange.UNCHANGEDotherwise.
-
removeAllMedia
Remove all media.- Returns:
EChange.CHANGEDif any medium was removed,EChange.UNCHANGEDotherwise. Nevernull.- Since:
- 3.7.3
-
getMediaCount
- Specified by:
getMediaCountin interfaceICSSMediaList- Returns:
- The number of contained media. Always ≥ 0.
-
hasNoMedia
public boolean hasNoMedia()- Specified by:
hasNoMediain interfaceICSSMediaList- Returns:
trueif no explicit media is defined,falseif a media is defined.
-
containsMedium
Description copied from interface:ICSSMediaListCheck if the passed medium is explicitly specified- Specified by:
containsMediumin interfaceICSSMediaList- Parameters:
eMedium- The medium to be checked. May benull.- Returns:
trueif it is contained,falseotherwise
-
getAllMedia
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsOrderedSet<ECSSMedium> getAllMedia()- Specified by:
getAllMediain interfaceICSSMediaList- Returns:
- A copy of all specified media in the order they were specified.
Never
nullbut maybe empty.
-
getMediaString
- Specified by:
getMediaStringin interfaceICSSMediaList- Parameters:
sSeparator- The separator to be used. May not benull.- Returns:
- A non-
nullbut maybe empty String with all media in the order they where inserted and separated by the specified separator
-
getClone
- Specified by:
getClonein interfacecom.helger.commons.lang.ICloneable<CSSMediaList>
-
equals
-
hashCode
public int hashCode() -
toString
-
createOnDemand
@Nonnull @ReturnsMutableCopy public static CSSMediaList createOnDemand(@Nullable ICSSMediaList aMediaList)
-