net.sourceforge.pmd.lang.rule.properties

## Class AbstractEnumeratedProperty<E,T>

- java.lang.Object
- - net.sourceforge.pmd.lang.rule.properties.AbstractProperty<T>
  - - net.sourceforge.pmd.lang.rule.properties.AbstractEnumeratedProperty<E,T>

Type Parameters:
  `T` -

All Implemented Interfaces:
  Comparable<PropertyDescriptor<?>>, PropertyDescriptor<T>

Direct Known Subclasses:
  EnumeratedMultiProperty, EnumeratedProperty

    public abstract class AbstractEnumeratedProperty<E,T>
    extends AbstractProperty<T>

Author:
  Brian Remedios

### Field Summary

Fields
`protected Object[][]` `choices`
`protected Map<String,E>` `choicesByLabel`
`protected Map<E,String>` `labelsByChoice`

### Constructor Summary

Constructors
Constructor and Description
`AbstractEnumeratedProperty(String theName, String theDescription, String[] theLabels, E[] theChoices, int[] choiceIndices, float theUIOrder, boolean isMulti)`

### Method Summary

Methods
`protected E` `choiceFrom(String label)` Method choiceFrom.
`Object[][]` `choices()` Returns a set of choice tuples if available, returns null if none are defined.
`protected String` `defaultAsString()`
`protected String` `nonLegalValueMsgFor(Object value)` Method nonLegalValueMsgFor.

### Methods inherited from class net.sourceforge.pmd.lang.rule.properties.AbstractProperty

`addAttributesTo, areEqual, asDelimitedString, asDelimitedString, asString, attributeValuesById, compareTo, defaultHasNullValue, defaultValue, description, equals, errorFor, hashCode, isArray, isMultiValue, isRequired, multiValueDelimiter, name, preferredRowCount, propertyErrorFor, toString, typeErrorFor, uiOrder, valueErrorFor, valuesErrorFor`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface net.sourceforge.pmd.PropertyDescriptor

`type, valueFrom`

### Field Detail

#### choicesByLabel

    protected Map<String,E> choicesByLabel

#### labelsByChoice

    protected Map<E,String> labelsByChoice

#### choices

    protected Object[][] choices

### Constructor Detail

#### AbstractEnumeratedProperty

    public AbstractEnumeratedProperty(String theName,
                              String theDescription,
                              String[] theLabels,
                              E[] theChoices,
                              int[] choiceIndices,
                              float theUIOrder,
                              boolean isMulti)

Parameters:
  `theName` -
  `theDescription` -
  `theLabels` -
  `theChoices` -
  `choiceIndices` -
  `theUIOrder` -
  `isMulti` -
Throws:
  `IllegalArgumentException`

### Method Detail

#### defaultAsString

    protected String defaultAsString()

Specified by:
  `defaultAsString` in class `AbstractProperty<T>`
Returns:
  String

#### nonLegalValueMsgFor

    protected String nonLegalValueMsgFor(Object value)

Method nonLegalValueMsgFor.

Parameters:
  `value` - Object
Returns:
  String

#### choiceFrom

    protected E choiceFrom(String label)

Method choiceFrom.

Parameters:
  `label` - String
Returns:
  E

#### choices

    public Object[][] choices()

Description copied from class: `AbstractProperty`
Returns a set of choice tuples if available, returns null if none are defined.

Specified by:
  `choices` in interface `PropertyDescriptor<T>`
Overrides:
  `choices` in class `AbstractProperty<T>`
Returns:
  Object[][]
See Also:
  `PropertyDescriptor.choices()`