Class ShorthandDatabase

java.lang.Object
io.sf.carte.doc.style.css.property.ShorthandDatabase

public final class ShorthandDatabase extends Object
Database of shorthand-related property information.
  • Constructor Details

    • ShorthandDatabase

      public ShorthandDatabase(ClassLoader loader)
      Construct a shorthand database that uses the given ClassLoader to load files from classpath.
      Parameters:
      loader - the loader.
  • Method Details

    • getInstance

      public static ShorthandDatabase getInstance()
      Gets an instance of this class.
      Returns:
      an instance of ShorthandDatabase.
    • isShorthand

      public boolean isShorthand(String name)
      Is this a shorthand property?
      Parameters:
      name - the name of the property.
      Returns:
      true if is a shorthand, false otherwise.
    • isShorthandSubproperty

      public boolean isShorthandSubproperty(String name)
      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

      public String getShorthand(String subproperty)
      Gets the shorthand for this subproperty, if any.
      Parameters:
      subproperty - the subproperty name.
      Returns:
      the name of the shorthand for this subproperty, or null if subproperty is not a recognized subproperty.
    • isShorthandSubpropertyOf

      public boolean isShorthandSubpropertyOf(String shorthand, String subpName)
      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

      public String[] getShorthandSubproperties(String shorthandName)
      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

      public String[] getLonghandProperties(String shorthandName)
      Get an array with the names of the longhand subproperties for shorthandName.

      For convenience of the library's internals, the array is incomplete for the font shorthand, due to font-variant handling, and also for border due to interaction with border-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

      public boolean isIdentifierValue(String propertyName, String value)
      Determines if the given value is an identifier for the given property name.

      Generic identifiers such as inherit or none 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 if value is recognized as an identifier of propertyName, false otherwise.
    • hasKnownIdentifierValues

      public boolean hasKnownIdentifierValues(String propertyName)
      Determines if the given property has known identifier values that could be checked with isIdentifierValue(String, String).
      Parameters:
      propertyName - the lowercase name of the property.
      Returns:
      true if propertyName has identifiers known to this database.