@NotThreadSafe public class CSSMediaList extends Object implements ICSSMediaList, com.helger.commons.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 |
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 |
isEmpty() |
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
|
int |
size() |
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 ICSSMediaList
public boolean hasAnyMedia()
hasAnyMedia
in interface ICSSMediaList
true
if any explicit media is defined,
false
if not.public boolean hasNoMedia()
hasNoMedia
in interface ICSSMediaList
true
if no explicit media is defined,
false
if a media is defined.public boolean hasNoMediaOrAll()
hasNoMediaOrAll
in interface ICSSMediaList
true
if no explicit media is defined or if
ECSSMedium.ALL
is contained.public boolean containsMedium(@Nullable ECSSMedium eMedium)
ICSSMediaList
containsMedium
in interface ICSSMediaList
eMedium
- The medium to be checked. May be null
.true
if it is contained, false
otherwisepublic boolean containsMediumOrAll(@Nullable ECSSMedium eMedium)
ICSSMediaList
ECSSMedium.ALL
is explicitly
specifiedcontainsMediumOrAll
in interface ICSSMediaList
eMedium
- The medium to be checked. May be null
.true
if the passed medium or the "all" medium is
contained, false
otherwisepublic boolean isForScreen()
ICSSMediaList
isForScreen
in interface ICSSMediaList
true
if the media list is usable for screen display@Nonnull @ReturnsMutableCopy public Set<ECSSMedium> getAllMedia()
getAllMedia
in interface ICSSMediaList
null
but maybe empty.@Nonnull public String getMediaString()
getMediaString
in interface ICSSMediaList
null
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 ICSSMediaList
sSeparator
- 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@Nonnegative public int size()
size
in interface com.helger.commons.IHasSize
public boolean isEmpty()
isEmpty
in interface com.helger.commons.IHasSize
@Nonnull @ReturnsMutableCopy public CSSMediaList getClone()
getClone
in interface com.helger.commons.ICloneable<CSSMediaList>
Copyright © 2014–2015 Philip Helger. All rights reserved.