@NotThreadSafe public class CSSValue extends Object implements ICSSValue
ICSSProperty)
and it's according value plus the important state (!important or
not). The main purpose of this class to make building a CSS from scratch
simpler. When an existing CSS is read the information resides in a
CSSDeclaration because it contains the
declaration value in a more structured form.| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_CONSISTENCY_CHECKS_ENABLED |
| Constructor and Description |
|---|
CSSValue(ICSSProperty aProperty,
String sValue,
boolean bIsImportant)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areConsistencyChecksEnabled() |
boolean |
equals(Object o) |
String |
getAsCSSString(ICSSWriterSettings aSettings,
int nIndentLevel)
Get the contents of this object as a serialized CSS string for writing to
an output.
|
ECSSProperty |
getProp() |
ICSSProperty |
getProperty() |
String |
getPropertyName() |
String |
getValue() |
int |
hashCode() |
boolean |
isImportant() |
static void |
setConsistencyChecksEnabled(boolean bEnabled)
Enable or disable consistency checks.
|
CSSValue |
setImportant(boolean bIsImportant)
Set the important flag of this value.
|
CSSValue |
setProperty(ICSSProperty aProperty)
Set the property of this CSS value (e.g.
|
CSSValue |
setValue(String sValue)
Set the value of this CSS value (e.g.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetAsCSSString, getAsCSSStringpublic static final boolean DEFAULT_CONSISTENCY_CHECKS_ENABLED
public CSSValue(@Nonnull ICSSProperty aProperty, @Nonnull String sValue, boolean bIsImportant)
aProperty - The CSS property. May not be null.sValue - The String value to use. May be null. The value may
NOT contain the !important flag! The
value is internally trimmed to avoid leading and trailing.bIsImportant - true if the value should be important,
false otherwisepublic static boolean areConsistencyChecksEnabled()
true if consistency checks are enabled (by default),
false if not.public static void setConsistencyChecksEnabled(boolean bEnabled)
bEnabled - true to enable them, false to disable
them.@Nonnull public ICSSProperty getProperty()
null.@Nonnull public ECSSProperty getProp()
@Nonnull @Nonempty public String getPropertyName()
null nor empty.@Nonnull public CSSValue setProperty(@Nonnull ICSSProperty aProperty)
background-color).aProperty - The CSS property to set. May not be null.@Nonnull public String getValue()
null but maybe empty.@Nonnull public CSSValue setValue(@Nonnull String sValue)
red in case the property
is background-color).sValue - The value to be set. May not be null. The value may
NOT contain the !important flag! The
value is internally trimmed to avoid leading and trailing.public boolean isImportant()
true if it is important, false if not@Nonnull public CSSValue setImportant(boolean bIsImportant)
bIsImportant - true to mark it important, false to remove
it.@Nonnull public String getAsCSSString(@Nonnull ICSSWriterSettings aSettings, @Nonnegative int nIndentLevel)
ICSSWriteablegetAsCSSString in interface ICSSWriteableaSettings - The settings to be used to format the output. May not be
null.nIndentLevel - The current indentation levelnull.Copyright © 2014–2022 Philip Helger. All rights reserved.