net.sourceforge.pmd.lang.rule.properties

## Class EnumeratedMultiProperty<E>

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

- Type Parameters:
    `E` -
  All Implemented Interfaces:
    Comparable<PropertyDescriptor<?>>, PropertyDescriptor<Object[]>

      public class EnumeratedMultiProperty<E>
      extends AbstractEnumeratedProperty<E,Object[]>

  Defines a datatype with a set of preset values of any type as held within a pair of maps. While the values are not serialized out, the labels are and serve as keys to obtain the values. The choices() method provides the ordered selections to be used in an editor widget.
  Author:
    Brian Remedios

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static PropertyDescriptorFactory` | `FACTORY`

    - ### Fields inherited from class net.sourceforge.pmd.lang.rule.properties.AbstractEnumeratedProperty

      `choices, choicesByLabel, labelsByChoice`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EnumeratedMultiProperty(String theName, String theDescription, String[] theLabels, E[] theChoices, int[] choiceIndices, float theUIOrder)` Constructor for EnumeratedProperty.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `asDelimitedString(Object[] value)` Formats the object onto a string suitable for storage within the property map.
    `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.
    `Class<Object[]>` | `type()` Denotes the value datatype.
    `Object[]` | `valueFrom(String value)` If the property is multi-valued then return the separate values after parsing the propertyString provided.

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

      `choiceFrom, choices, defaultAsString, nonLegalValueMsgFor`

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

      `addAttributesTo, areEqual, asDelimitedString, asString, attributeValuesById, compareTo, defaultHasNullValue, defaultValue, description, equals, hashCode, isArray, 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`

- - ### Field Detail

    - #### FACTORY

          public static final PropertyDescriptorFactory FACTORY

  - ### Constructor Detail

    - #### EnumeratedMultiProperty

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

      Constructor for EnumeratedProperty.
      Parameters:
        `theName` - String
        `theDescription` - String
        `theLabels` - String[]
        `theChoices` - E[]
        `choiceIndices` - int[]
        `theUIOrder` - float
      Throws:
        `IllegalArgumentException`

  - ### Method Detail

    - #### type

          public Class<Object[]> type()

      Description copied from interface: `PropertyDescriptor`
      Denotes the value datatype.
      Returns:
        Class
      See Also:
        `PropertyDescriptor.type()`

    - #### isMultiValue

          public boolean isMultiValue()

      Description copied from class: `AbstractProperty`
      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.
      Specified by:
        `isMultiValue` in interface `PropertyDescriptor<Object[]>`
      Overrides:
        `isMultiValue` in class `AbstractProperty<Object[]>`
      Returns:
        boolean
      See Also:
        `PropertyDescriptor.isMultiValue()`

    - #### errorFor

          public String errorFor(Object value)

      Description copied from class: `AbstractProperty`
      Validation function that returns a diagnostic error message for a sample property value. Returns null if the value is acceptable.
      Specified by:
        `errorFor` in interface `PropertyDescriptor<Object[]>`
      Overrides:
        `errorFor` in class `AbstractProperty<Object[]>`
      Parameters:
        `value` - Object
      Returns:
        String
      See Also:
        `PropertyDescriptor.errorFor(Object)`

    - #### valueFrom

          public Object[] valueFrom(String value)
                             throws IllegalArgumentException

      Description copied from interface: `PropertyDescriptor`
      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:
        `value` - String
      Returns:
        Object
      Throws:
        `IllegalArgumentException`
      See Also:
        `PropertyDescriptor.valueFrom(String)`

    - #### asDelimitedString

          public String asDelimitedString(Object[] value)

      Description copied from class: `AbstractProperty`
      Formats the object onto a string suitable for storage within the property map.
      Specified by:
        `asDelimitedString` in interface `PropertyDescriptor<Object[]>`
      Overrides:
        `asDelimitedString` in class `AbstractProperty<Object[]>`
      Parameters:
        `value` - Object
      Returns:
        String
      See Also:
        `PropertyDescriptor.asDelimitedString(Object)`

Copyright © 2002-2013 InfoEther. All Rights Reserved.