java.lang.Object
io.sf.carte.doc.style.css.property.ShorthandDatabase
Database of shorthand-related property information.
-
Constructor Summary
ConstructorDescriptionShorthandDatabase
(ClassLoader loader) Construct a shorthand database that uses the givenClassLoader
to load files from classpath. -
Method Summary
Modifier and TypeMethodDescriptionstatic ShorthandDatabase
Gets an instance of this class.String[]
getLonghandProperties
(String shorthandName) Get an array with the names of the longhand subproperties forshorthandName
.getShorthand
(String subproperty) Gets the shorthand for this subproperty, if any.String[]
getShorthandSubproperties
(String shorthandName) Get the subproperties of the given shorthand.boolean
hasKnownIdentifierValues
(String propertyName) Determines if the given property has known identifier values that could be checked withisIdentifierValue(String, String)
.boolean
isIdentifierValue
(String propertyName, String value) Determines if the given value is an identifier for the given property name.boolean
isShorthand
(String name) Is this a shorthand property?boolean
isShorthandSubproperty
(String name) Is this the subproperty of a shorthand property?boolean
isShorthandSubpropertyOf
(String shorthand, String subpName) Is the given property name a subproperty of the given shorthand property ?
-
Constructor Details
-
ShorthandDatabase
Construct a shorthand database that uses the givenClassLoader
to load files from classpath.- Parameters:
loader
- the loader.
-
-
Method Details
-
getInstance
Gets an instance of this class.- Returns:
- an instance of ShorthandDatabase.
-
isShorthand
Is this a shorthand property?- Parameters:
name
- the name of the property.- Returns:
true
if is a shorthand,false
otherwise.
-
isShorthandSubproperty
Is this the subproperty of a shorthand property?- Parameters:
name
- the name of the property.- Returns:
true
if is a shorthand subproperty,false
otherwise.
-
getShorthand
Gets the shorthand for this subproperty, if any.- Parameters:
subproperty
- the subproperty name.- Returns:
- the name of the shorthand for this subproperty, or
null
ifsubproperty
is not a recognized subproperty.
-
isShorthandSubpropertyOf
Is the given property name a subproperty of the given shorthand property ?- Parameters:
shorthand
- the name of the shorthand property to test.subpName
- the name of the possible subproperty.- Returns:
true
if subpName is a subproperty of the given shorthand, false otherwise.
-
getShorthandSubproperties
Get the subproperties of the given shorthand.The subproperties may be, in turn, shorthands.
- Parameters:
shorthandName
- the shorthand name.- Returns:
- the array of subproperties, or
null
if the shorthand name is not known.
-
getLonghandProperties
Get an array with the names of the longhand subproperties forshorthandName
.For convenience of the library's internals, the array is incomplete for the
font
shorthand, due tofont-variant
handling, and also forborder
due to interaction withborder-image
.- Parameters:
shorthandName
- the shorthand name.- Returns:
- an array with the names of the longhand subproperties, or
null
if the shorthand name is not known.
-
isIdentifierValue
Determines if the given value is an identifier for the given property name.Generic identifiers such as
inherit
ornone
are not checked.If the property name ends with '-color', the value is checked for a valid color value identifier, regardless of the property name being known or not.
- Parameters:
propertyName
- the lowercase name of the property.value
- the value that has to be tested to be an identifier for propertyName.- Returns:
true
ifvalue
is recognized as an identifier ofpropertyName
,false
otherwise.
-
hasKnownIdentifierValues
Determines if the given property has known identifier values that could be checked withisIdentifierValue(String, String)
.- Parameters:
propertyName
- the lowercase name of the property.- Returns:
true
ifpropertyName
has identifiers known to this database.
-