public class CssSyntaxUtils extends Object
| Constructor and Description |
|---|
CssSyntaxUtils() |
| Modifier and Type | Method and Description |
|---|---|
static List<CssProperty> |
extractProperties(String text)
Extracts CSS properties from the provided
String. |
static List<CssProperty> |
extractRules(String text,
MessageLog messageLog)
Extracts CSS properties from the provided
String and logs warnings to the
provided MessageLog. |
static String |
getValue(Map<String,CssProperty> rules,
String property)
Returns the value of a CSS property if it exists,
null otherwise. |
static boolean |
hasNonBlankValue(Map<String,CssProperty> properties,
String propertyName)
Returns
true if the the provided map contains a property with the
specified name that has a non-blank value. |
static Color |
parseColor(String colorValue,
MessageLog messageLog,
Color defaultColor)
Parses a hexadecimal format (#fff or #ffffff) of CSS color into a
Color
object. |
static Map<String,CssProperty> |
propertiesAsMap(Collection<CssProperty> rules)
Converts the provided collection of CSS properties to a
Map with keys being
property names and values being CssProperty objects. |
static String |
unpackUrl(String urlValue)
Extracts the actual url from the CSS url expression like
url('actua_url'). |
static String |
unpackUrl(String urlValue,
MessageLog messageLog)
Extracts the actual url from the CSS url expression like
url('actua_url') and logs
warnings to the provided MessageLog. |
public static List<CssProperty> extractProperties(String text)
String.public static List<CssProperty> extractRules(String text, MessageLog messageLog)
String and logs warnings to the
provided MessageLog.public static Map<String,CssProperty> propertiesAsMap(Collection<CssProperty> rules)
Map with keys being
property names and values being CssProperty objects.public static String getValue(Map<String,CssProperty> rules, String property)
null otherwise.public static boolean hasNonBlankValue(Map<String,CssProperty> properties, String propertyName)
true if the the provided map contains a property with the
specified name that has a non-blank value.public static String unpackUrl(String urlValue)
url('actua_url').public static String unpackUrl(String urlValue, MessageLog messageLog)
url('actua_url') and logs
warnings to the provided MessageLog.public static Color parseColor(String colorValue, MessageLog messageLog, Color defaultColor)
Color
object. The RGB format (rgb(100, 0, 0)) is currently not supported. In case of
parse errors, the default is returnedCopyright © 2013 Carrot Search s.c.. All Rights Reserved.