Class Property
- java.lang.Object
-
- com.google.common.css.compiler.ast.Property
-
public final class Property extends java.lang.ObjectAn object that represents a CSS property. Although this class contains a large set of built-in properties (seeallRecognizedProperties()), 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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.Set<Property>allRecognizedProperties()static java.util.Set<java.lang.String>allRecognizedPropertyNames()static PropertybyName(java.lang.String name)java.lang.StringgetName()java.lang.StringgetPartition()Gets the partition of this property.java.util.Set<java.lang.String>getShorthands()Returns the set of shorthand properties related to this property, or the empty set if this property is not standard.VendorgetVendor()java.lang.StringgetWarning()booleanhasPositionalParameters()booleanhasWarning()booleanisCustom()booleanisRecognizedProperty()booleanisSvgOnly()booleanisVendorSpecific()
-
-
-
Method Detail
-
byName
public static Property byName(java.lang.String name)
- Returns:
- a
Propertywith the specifiedname. Ifnamecorresponds to a recognized property, then the correspondingPropertywill be returned; otherwise, a newPropertywith the specifiednamewill be created.
-
getName
public java.lang.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 java.util.Set<java.lang.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-stylehasborder,border-leftandborder-styleas shorthands.
-
getPartition
public java.lang.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-topare all in thepaddingpartition. As another example,z-indexis 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
VendorifisVendorSpecific()returnstrue; otherwise, returnsnull
-
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 java.lang.String getWarning()
-
allRecognizedPropertyNames
public static java.util.Set<java.lang.String> allRecognizedPropertyNames()
- Returns:
- an immutable set of CSS properties recognized by default by the CSS Compiler
-
-