Package com.helger.css.propertyvalue
Class CSSValue
java.lang.Object
com.helger.css.propertyvalue.CSSValue
- All Implemented Interfaces:
ICSSWriteable,ICSSValue
Represents the combination of a single CSS property (
Instances of this class are mutable since 3.7.3.
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.Instances of this class are mutable since 3.7.3.
- Author:
- Philip Helger
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCSSValue(ICSSProperty aProperty, String sValue, boolean bIsImportant) Constructor -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanbooleangetAsCSSString(ICSSWriterSettings aSettings, int nIndentLevel) Get the contents of this object as a serialized CSS string for writing to an output.getProp()getValue()inthashCode()booleanstatic voidsetConsistencyChecksEnabled(boolean bEnabled) Enable or disable consistency checks.setImportant(boolean bIsImportant) Set the important flag of this value.setProperty(ICSSProperty aProperty) Set the property of this CSS value (e.g.Set the value of this CSS value (e.g.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.css.ICSSWriteable
getAsCSSString, getAsCSSString
-
Field Details
-
DEFAULT_CONSISTENCY_CHECKS_ENABLED
public static final boolean DEFAULT_CONSISTENCY_CHECKS_ENABLED- See Also:
-
-
Constructor Details
-
CSSValue
Constructor- Parameters:
aProperty- The CSS property. May not benull.sValue- The String value to use. May benull. The value may NOT contain the!importantflag! The value is internally trimmed to avoid leading and trailing.bIsImportant-trueif the value should be important,falseotherwise
-
-
Method Details
-
areConsistencyChecksEnabled
public static boolean areConsistencyChecksEnabled()- Returns:
trueif consistency checks are enabled (by default),falseif not.- Since:
- 5.0.2
-
setConsistencyChecksEnabled
public static void setConsistencyChecksEnabled(boolean bEnabled) Enable or disable consistency checks. By default the consistency checks are enabled (for backwards compatibility) but if performance is a real matter, you may want to disable them globally.- Parameters:
bEnabled-trueto enable them,falseto disable them.- Since:
- 5.0.2
-
getProperty
- Returns:
- The CSS property used. Never
null.
-
getProp
-
getPropertyName
- Returns:
- The property name including an eventually contained vendor prefix.
Neither
nullnor empty. - Since:
- 3.9.0
-
setProperty
Set the property of this CSS value (e.g.background-color).- Parameters:
aProperty- The CSS property to set. May not benull.- Returns:
- this
- Since:
- 3.7.3
-
getValue
- Returns:
- The CSS value used. May not be
nullbut maybe empty.
-
setValue
Set the value of this CSS value (e.g.redin case the property isbackground-color).- Parameters:
sValue- The value to be set. May not benull. The value may NOT contain the!importantflag! The value is internally trimmed to avoid leading and trailing.- Returns:
- this
- Since:
- 3.7.3
-
isImportant
public boolean isImportant()- Returns:
trueif it is important,falseif not
-
setImportant
Set the important flag of this value.- Parameters:
bIsImportant-trueto mark it important,falseto remove it.- Returns:
- this
- Since:
- 3.7.3
-
getAsCSSString
@Nonnull public String getAsCSSString(@Nonnull ICSSWriterSettings aSettings, @Nonnegative int nIndentLevel) Description copied from interface:ICSSWriteableGet the contents of this object as a serialized CSS string for writing to an output.- Specified by:
getAsCSSStringin interfaceICSSWriteable- Parameters:
aSettings- The settings to be used to format the output. May not benull.nIndentLevel- The current indentation level- Returns:
- The content of this object as CSS string. Never
null.
-
equals
-
hashCode
public int hashCode() -
toString
-