Class Property

java.lang.Object
com.google.common.css.compiler.ast.Property

public final class Property extends Object
An object that represents a CSS property. Although this class contains a large set of built-in properties (see allRecognizedProperties()), it is a class rather than an enum so that it is possible to create properties that are not built-in. User agents will likely add support for new properties faster than we can add them to this list.
  • Method Details

    • byName

      public static Property byName(String name)
      Returns:
      a Property with the specified name. If name corresponds to a recognized property, then the corresponding Property will be returned; otherwise, a new Property with the specified name will be created.
    • getName

      public String getName()
      Returns:
      the name of this CSS property as it appears in a stylesheet, such as "z-index"
    • isRecognizedProperty

      public boolean isRecognizedProperty()
      Returns:
      whether this Property is recognized by default by the CSS Compiler. Note that this is not the same as a being a "standard" CSS property because the CSS Compiler recognizes non-standard CSS properties such as "-webkit-border-radius", among others.
    • getShorthands

      public Set<String> getShorthands()
      Returns the set of shorthand properties related to this property, or the empty set if this property is not standard.

      For example, border-left-style has border, border-left and border-style as shorthands.

    • getPartition

      public String getPartition()
      Gets the partition of this property. All properties with the same partition share a common shorthand. A non-standard property is its own single partition.

      For example, padding, padding-bottom, padding-left, padding-right, padding-top are all in the padding partition. As another example, z-index is its own single partition.

      Returns:
      a string representing the partition
    • isVendorSpecific

      public boolean isVendorSpecific()
      Returns:
      whether this Property is a vendor-specific CSS property, such as "-webkit-border-radius"
    • getVendor

      @Nullable public Vendor getVendor()
      Returns:
      the corresponding Vendor if isVendorSpecific() returns true; otherwise, returns null
    • hasPositionalParameters

      public boolean hasPositionalParameters()
      Returns:
      whether this property can take positional parameters, such as "margin", where the parameters "1px 2px 3px" imply "1px 2px 3px 2px"
    • isCustom

      public boolean isCustom()
      Returns:
      whether this is a CSS custom property
    • isSvgOnly

      public boolean isSvgOnly()
    • hasWarning

      public boolean hasWarning()
    • getWarning

      public String getWarning()
    • allRecognizedPropertyNames

      public static Set<String> allRecognizedPropertyNames()
      Returns:
      an immutable set of CSS properties recognized by default by the CSS Compiler
    • allRecognizedProperties

      public static Set<Property> allRecognizedProperties()
      Returns:
      an immutable set of Property instances recognized by default by the CSS Compiler