@NotThreadSafe public class CSSMediaList extends Object implements ICSSMediaList, com.helger.commons.lang.ICloneable<CSSMediaList>
ECSSMedium objects.| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_MEDIA_STRING_SEPARATOR |
| Constructor and Description |
|---|
CSSMediaList()
Constructor
|
CSSMediaList(CSSMediaList aOther)
Copy constructor.
|
CSSMediaList(ECSSMedium... aMedia)
Constructor with an array of media.
|
CSSMediaList(ECSSMedium eMedium)
Constructor with a single medium
|
CSSMediaList(ICSSMediaList aOther)
Constructor using another media list.
|
CSSMediaList(Iterable<ECSSMedium> aMedia)
Constructor with a collection of media.
|
| Modifier and Type | Method and Description |
|---|---|
CSSMediaList |
addMedia(ECSSMedium... aMediaList)
Add a media list to the list
|
CSSMediaList |
addMedia(ICSSMediaList aMediaList)
Add a media list to the list
|
CSSMediaList |
addMedia(Iterable<ECSSMedium> aMediaList)
Add a media list to the list
|
CSSMediaList |
addMedium(ECSSMedium eMedium)
Add a new medium to the list
|
boolean |
containsMedium(ECSSMedium eMedium)
Check if the passed medium is explicitly specified
|
boolean |
containsMediumOrAll(ECSSMedium eMedium)
Check if the passed medium or the
ECSSMedium.ALL is explicitly
specified |
static CSSMediaList |
createOnDemand(ICSSMediaList aMediaList) |
boolean |
equals(Object o) |
Set<ECSSMedium> |
getAllMedia() |
CSSMediaList |
getClone() |
int |
getMediaCount() |
String |
getMediaString() |
String |
getMediaString(String sSeparator) |
boolean |
hasAnyMedia() |
int |
hashCode() |
boolean |
hasNoMedia() |
boolean |
hasNoMediaOrAll() |
boolean |
isForScreen()
Check if the passed medium is usable for the screen.
|
com.helger.commons.state.EChange |
removeAllMedia()
Remove all media.
|
com.helger.commons.state.EChange |
removeMedium(ECSSMedium eMedium)
Remove the passed medium
|
String |
toString() |
public static final String DEFAULT_MEDIA_STRING_SEPARATOR
public CSSMediaList()
public CSSMediaList(@Nonnull ECSSMedium eMedium)
eMedium - The medium to be added. May not be null.public CSSMediaList(@Nullable ECSSMedium... aMedia)
aMedia - The array of media to be added. The array may be null
but it may not contain null elements.public CSSMediaList(@Nullable Iterable<ECSSMedium> aMedia)
aMedia - The collection of media to be added. The collection may be
null but it may not contain null elements.public CSSMediaList(@Nonnull ICSSMediaList aOther)
aOther - The object to copy from. May not be null.public CSSMediaList(@Nonnull CSSMediaList aOther)
aOther - The object to copy from. May not be null.@Nonnull public CSSMediaList addMedium(@Nonnull ECSSMedium eMedium)
eMedium - The medium to be added. May not be null.this@Nonnull public CSSMediaList addMedia(@Nonnull ECSSMedium... aMediaList)
aMediaList - The media list to be added. May not be null.this@Nonnull public CSSMediaList addMedia(@Nonnull ICSSMediaList aMediaList)
aMediaList - The media list to be added. May not be null.this@Nonnull public CSSMediaList addMedia(@Nonnull Iterable<ECSSMedium> aMediaList)
aMediaList - The media list to be added. May not be null.this@Nonnull public com.helger.commons.state.EChange removeMedium(@Nullable ECSSMedium eMedium)
eMedium - The medium to be removed. May be null.EChange.CHANGED if the medium was removed,
EChange.UNCHANGED otherwise.@Nonnull public com.helger.commons.state.EChange removeAllMedia()
EChange.CHANGED if any medium was removed,
EChange.UNCHANGED otherwise. Never null.@Nonnegative public int getMediaCount()
getMediaCount in interface ICSSMediaListpublic boolean hasAnyMedia()
hasAnyMedia in interface ICSSMediaListtrue if any explicit media is defined,
false if not.public boolean hasNoMedia()
hasNoMedia in interface ICSSMediaListtrue if no explicit media is defined,
false if a media is defined.public boolean hasNoMediaOrAll()
hasNoMediaOrAll in interface ICSSMediaListtrue if no explicit media is defined or if
ECSSMedium.ALL is contained.public boolean containsMedium(@Nullable ECSSMedium eMedium)
ICSSMediaListcontainsMedium in interface ICSSMediaListeMedium - The medium to be checked. May be null.true if it is contained, false otherwisepublic boolean containsMediumOrAll(@Nullable ECSSMedium eMedium)
ICSSMediaListECSSMedium.ALL is explicitly
specifiedcontainsMediumOrAll in interface ICSSMediaListeMedium - The medium to be checked. May be null.true if the passed medium or the "all" medium is
contained, false otherwisepublic boolean isForScreen()
ICSSMediaListisForScreen in interface ICSSMediaListtrue if the media list is usable for screen display@Nonnull @ReturnsMutableCopy public Set<ECSSMedium> getAllMedia()
getAllMedia in interface ICSSMediaListnull but maybe empty.@Nonnull public String getMediaString()
getMediaString in interface ICSSMediaListnull but maybe empty String with all media in
the order they where inserted and separated by
ICSSMediaList.getMediaString(String)@Nonnull public String getMediaString(@Nonnull String sSeparator)
getMediaString in interface ICSSMediaListsSeparator - The separator to be used. May not be null.null but maybe empty String with all media in
the order they where inserted and separated by the specified
separator@Nonnull @ReturnsMutableCopy public CSSMediaList getClone()
getClone in interface com.helger.commons.lang.ICloneable<CSSMediaList>@Nonnull @ReturnsMutableCopy public static CSSMediaList createOnDemand(@Nullable ICSSMediaList aMediaList)
Copyright © 2014–2016 Philip Helger. All rights reserved.