T
- type of the property's value. This is a list type for multi-valued properties.public interface PropertyDescriptor<T> extends java.lang.Comparable<PropertyDescriptor<?>>
This interface is primarily specialized according to whether the property is multi-valued or single-valued, see
SingleValuePropertyDescriptor
and MultiValuePropertyDescriptor
.
Several interfaces further specialize the behaviour of descriptors to accommodate specific types of descriptors,
see NumericPropertyDescriptor
and EnumeratedPropertyDescriptor
.
Modifier and Type | Method and Description |
---|---|
java.lang.String |
asDelimitedString(T value)
Formats the object onto a string suitable for storage within the property map.
|
java.util.Map<PropertyDescriptorField,java.lang.String> |
attributeValuesById()
Returns a map representing all the property attributes of the receiver in string form.
|
T |
defaultValue()
Default value to use when the user hasn't specified one or when they wish to revert to a known-good state.
|
java.lang.String |
description()
Describes the property and the role it plays within the rule it is specified for.
|
java.lang.String |
errorFor(T value)
Validation function that returns a diagnostic error message for a sample property value.
|
boolean |
isDefinedExternally()
True if this descriptor was defined in the ruleset xml.
|
boolean |
isMultiValue()
Returns whether the property is multi-valued, i.e.
|
java.lang.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.
|
java.lang.String |
propertyErrorFor(Rule rule)
A convenience method that returns an error string if the rule holds onto a property value that has a problem.
|
java.lang.Class<?> |
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(java.lang.String propertyString)
Returns the value represented by this string.
|
java.lang.String name()
java.lang.String description()
java.lang.Class<?> type()
boolean isMultiValue()
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.
T defaultValue()
java.lang.String errorFor(T value)
value
- The value to check.float uiOrder()
Example:
name -> 0.0 description 1.0 minValue -> 2.0 maxValue -> 2.1
name: [ ] description: [ ] minimum: [ ] maximum: [ ]
T valueFrom(java.lang.String propertyString) throws java.lang.IllegalArgumentException
propertyString
- The string to parsejava.lang.IllegalArgumentException
- if the given string cannot be parsedjava.lang.String asDelimitedString(T value)
value
- Objectjava.lang.String propertyErrorFor(Rule rule)
rule
- Ruleint preferredRowCount()
java.util.Map<PropertyDescriptorField,java.lang.String> attributeValuesById()
boolean isDefinedExternally()
RuleSetWriter
to write out the property correctly: if it was defined externally, then its definition must be written out,
otherwise only its value.Copyright © 2002–2018 PMD. All rights reserved.