Package net.sourceforge.pmd.properties
Class PropertyDescriptor<T>
- java.lang.Object
-
- net.sourceforge.pmd.properties.PropertyDescriptor<T>
-
- Type Parameters:
T
- Type of the property's value
public final class PropertyDescriptor<T> extends Object
Describes a property of a rule or a renderer.Usage of this API is described on
PropertyFactory
.A property descriptor provides validation, serialization, and default values for a datatype
<T>
. Property descriptors are immutable and can be shared freely.- Version:
- 7.0.0
- Author:
- Brian Remedios, Clément Fournier
- See Also:
PropertyFactory
,PropertyBuilder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
defaultValue()
Default value to use when the user hasn't specified one or when they wish to revert to a known-good state.String
description()
Describes the property and the role it plays within the rule it is specified for.boolean
equals(Object o)
@Nullable PropertyTypeId
getTypeId()
Returns the type ID which was used to define this property.int
hashCode()
boolean
isXPathAvailable()
Returns whether the property is available to XPath queries.String
name()
The name of the property without spaces as it serves as the key into the property map.PropertySerializer<T>
serializer()
Returns the strategy used to read and write this property to XML.String
toString()
-
-
-
Method Detail
-
name
public String name()
The name of the property without spaces as it serves as the key into the property map.- Returns:
- String
-
description
public String description()
Describes the property and the role it plays within the rule it is specified for. Could be used in a tooltip.- Returns:
- String
-
defaultValue
public T defaultValue()
Default value to use when the user hasn't specified one or when they wish to revert to a known-good state.- Returns:
- Object
-
serializer
public PropertySerializer<T> serializer()
Returns the strategy used to read and write this property to XML. May support strings too.
-
getTypeId
@InternalApi public @Nullable PropertyTypeId getTypeId()
Returns the type ID which was used to define this property. Returns null if this property was defined in Java code and not in XML. This is used to write the property back to XML, when using aRuleSetWriter
.
-
isXPathAvailable
public boolean isXPathAvailable()
Returns whether the property is available to XPath queries.
-
-