net.sourceforge.pmd

## Interface PropertyDescriptor<T>

Type Parameters:
  `T` -

All Superinterfaces:
  Comparable<PropertyDescriptor<?>>

All Known Subinterfaces:
  NumericPropertyDescriptor<T>

All Known Implementing Classes:
  AbstractDelimitedProperty, AbstractEnumeratedProperty, AbstractMultiNumericProperty, AbstractMultiPackagedProperty, AbstractNumericProperty, AbstractPackagedProperty, AbstractProperty, AbstractScalarProperty, BooleanMultiProperty, BooleanProperty, CharacterMultiProperty, CharacterProperty, DoubleMultiProperty, DoubleProperty, EnumeratedMultiProperty, EnumeratedProperty, FileProperty, FloatMultiProperty, FloatProperty, IntegerMultiProperty, IntegerProperty, LongMultiProperty, LongProperty, MethodMultiProperty, MethodProperty, PropertyDescriptorWrapper, StringMultiProperty, StringProperty, TypeMultiProperty, TypeProperty

    public interface PropertyDescriptor<T>
    extends Comparable<PropertyDescriptor<?>>

Property value descriptor that defines the use & requirements for setting property values for use within PMD and any associated GUIs. While concrete descriptor instances are static and immutable they provide validation, serialization, and default values for any specific datatypes.

Author:
  Brian Remedios

### Method Summary

Methods
`String` `asDelimitedString(T value)` Formats the object onto a string suitable for storage within the property map.
`Map<String,String>` `attributeValuesById()` Returns a map representing all the property attributes of the receiver in string form.
`Object[][]` `choices()` Returns a set of choice tuples if available, returns null if none are defined.
`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.
`String` `errorFor(Object value)` Validation function that returns a diagnostic error message for a sample property value.
`boolean` `isMultiValue()` Returns whether the property is multi-valued, i.e. an array of strings, As unary property rule properties will return a value of one, you must use the get/setProperty accessors when working with the actual values.
`boolean` `isRequired()` Denotes whether the value is required before the rule can be executed.
`char` `multiValueDelimiter()` Return the character being used to delimit multiple property values within a single string.
`String` `name()` The name of the property without spaces as it serves as the key into the property map.
`int` `preferredRowCount()` If the datatype is a String then return the preferred number of rows to allocate in the text widget, returns a value of one for all other types.
`String` `propertyErrorFor(Rule rule)` A convenience method that returns an error string if the rule holds onto a property value that has a problem.
`Class<T>` `type()` Denotes the value datatype.
`float` `uiOrder()` Denotes the relative order the property field should occupy if we are using an auto-generated UI to display and edit property values.
`T` `valueFrom(String propertyString)` If the property is multi-valued then return the separate values after parsing the propertyString provided.

### Methods inherited from interface java.lang.Comparable

`compareTo`

### Method Detail

#### name

    String name()

The name of the property without spaces as it serves as the key into the property map.

Returns:
  String

#### description

    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

#### type

    Class<T> type()

Denotes the value datatype.

Returns:
  Class

#### isMultiValue

    boolean isMultiValue()

Returns whether the property is multi-valued, i.e. an array of strings, As unary property rule properties will return a value of one, you must use the get/setProperty accessors when working with the actual values. When working with multi-value properties then the get/setProperties accessors must be used.

Returns:
  boolean

#### defaultValue

    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

#### isRequired

    boolean isRequired()

Denotes whether the value is required before the rule can be executed. Has no meaning for primitive types such as booleans, ints, etc.

Returns:
  boolean

#### errorFor

    String errorFor(Object value)

Validation function that returns a diagnostic error message for a sample property value. Returns null if the value is acceptable.

Parameters:
  `value` - Object
Returns:
  String

#### uiOrder

    float uiOrder()

Denotes the relative order the property field should occupy if we are using an auto-generated UI to display and edit property values. If the value returned has a non-zero fractional part then this is can be used to place adjacent fields on the same row. Example: name -> 0.0 description 1.0 minValue -> 2.0 maxValue -> 2.1 ..would have their fields placed like: name: [ ] description: [ ] minimum: [ ] maximum: [ ]

Returns:
  float

#### valueFrom

    T valueFrom(String propertyString)
                throws IllegalArgumentException

If the property is multi-valued then return the separate values after parsing the propertyString provided. If it isn't a multi-valued property then the value will be returned within an array of size[1].

Parameters:
  `propertyString` - String
Returns:
  Object
Throws:
  `IllegalArgumentException`

#### asDelimitedString

    String asDelimitedString(T value)

Formats the object onto a string suitable for storage within the property map.

Parameters:
  `value` - Object
Returns:
  String

#### choices

    Object[][] choices()

Returns a set of choice tuples if available, returns null if none are defined.

Returns:
  Object[][]

#### propertyErrorFor

    String propertyErrorFor(Rule rule)

A convenience method that returns an error string if the rule holds onto a property value that has a problem. Returns null otherwise.

Parameters:
  `rule` - Rule
Returns:
  String

#### multiValueDelimiter

    char multiValueDelimiter()

Return the character being used to delimit multiple property values within a single string. You must ensure that this character does not appear within any rule property values to avoid deserialization errors.

Returns:
  char

#### preferredRowCount

    int preferredRowCount()

If the datatype is a String then return the preferred number of rows to allocate in the text widget, returns a value of one for all other types. Useful for multi-line XPATH editors.

Returns:
  int

#### attributeValuesById

    Map<String,String> attributeValuesById()

Returns a map representing all the property attributes of the receiver in string form.

Returns:
  Map<String, String>