net.sourceforge.pmd.lang.rule.properties
Class TypeMultiProperty

java.lang.Object
  extended by net.sourceforge.pmd.lang.rule.properties.AbstractProperty<T>
      extended by net.sourceforge.pmd.lang.rule.properties.AbstractPackagedProperty<T>
          extended by net.sourceforge.pmd.lang.rule.properties.AbstractMultiPackagedProperty<Class[]>
              extended by net.sourceforge.pmd.lang.rule.properties.TypeMultiProperty
All Implemented Interfaces:
Comparable<PropertyDescriptor<?>>, PropertyDescriptor<Class[]>

public class TypeMultiProperty
extends AbstractMultiPackagedProperty<Class[]>

Defines a property that supports multiple class types, even for primitive values! TODO - untested for array types

Author:
Brian Remedios

Field Summary
static PropertyDescriptorFactory FACTORY
           
 
Fields inherited from class net.sourceforge.pmd.lang.rule.properties.AbstractMultiPackagedProperty
DELIMITER
 
Fields inherited from class net.sourceforge.pmd.lang.rule.properties.AbstractPackagedProperty
PACKAGED_FIELD_TYPES_BY_KEY
 
Fields inherited from class net.sourceforge.pmd.lang.rule.properties.AbstractProperty
DEFAULT_DELIMITER, DEFAULT_NUMERIC_DELIMITER
 
Constructor Summary
TypeMultiProperty(String theName, String theDescription, Class<?>[] theDefaults, String[] legalPackageNames, float theUIOrder)
          Constructor for TypeProperty.
TypeMultiProperty(String theName, String theDescription, String theTypeDefaults, Map<String,String> otherParams, float theUIOrder)
          Constructor for TypeProperty.
TypeMultiProperty(String theName, String theDescription, String theTypeDefaults, String[] legalPackageNames, float theUIOrder)
          Constructor for TypeProperty.
 
Method Summary
protected  String asString(Object value)
          Return the value as a string that can be easily recognized and parsed when we see it again.
protected  String itemTypeName()
          Method itemTypeName.
protected  String packageNameOf(Object item)
           
 Class<Class[]> type()
          Denotes the value datatype.
static Class<?>[] typesFrom(String classesStr)
           
 Class<?>[] valueFrom(String valueString)
          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.AbstractMultiPackagedProperty
defaultAsString, isMultiValue
 
Methods inherited from class net.sourceforge.pmd.lang.rule.properties.AbstractPackagedProperty
addAttributesTo, legalPackageNames, packageNamesIn, valueErrorFor
 
Methods inherited from class net.sourceforge.pmd.lang.rule.properties.AbstractProperty
areEqual, asDelimitedString, asDelimitedString, attributeValuesById, choices, compareTo, defaultHasNullValue, defaultValue, description, equals, errorFor, hashCode, isArray, isRequired, multiValueDelimiter, name, preferredRowCount, propertyErrorFor, toString, typeErrorFor, uiOrder, 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

TypeMultiProperty

public TypeMultiProperty(String theName,
                         String theDescription,
                         Class<?>[] theDefaults,
                         String[] legalPackageNames,
                         float theUIOrder)
Constructor for TypeProperty.

Parameters:
theName - String
theDescription - String
theDefaults - Class[]
legalPackageNames - String[]
theUIOrder - float
Throws:
IllegalArgumentException

TypeMultiProperty

public TypeMultiProperty(String theName,
                         String theDescription,
                         String theTypeDefaults,
                         String[] legalPackageNames,
                         float theUIOrder)
Constructor for TypeProperty.

Parameters:
theName - String
theDescription - String
theTypeDefaults - String
legalPackageNames - String[]
theUIOrder - float
Throws:
IllegalArgumentException

TypeMultiProperty

public TypeMultiProperty(String theName,
                         String theDescription,
                         String theTypeDefaults,
                         Map<String,String> otherParams,
                         float theUIOrder)
Constructor for TypeProperty.

Parameters:
theName - String
theDescription - String
theTypeDefaults - String
otherParams - Map
theUIOrder - float
Throws:
IllegalArgumentException
Method Detail

typesFrom

public static Class<?>[] typesFrom(String classesStr)
Parameters:
classesStr - String
Returns:
Class[]

packageNameOf

protected String packageNameOf(Object item)
Specified by:
packageNameOf in class AbstractPackagedProperty<Class[]>
Parameters:
item - Object
Returns:
String

type

public Class<Class[]> type()
Description copied from interface: PropertyDescriptor
Denotes the value datatype.

Returns:
Class
See Also:
PropertyDescriptor.type()

itemTypeName

protected String itemTypeName()
Description copied from class: AbstractPackagedProperty
Method itemTypeName.

Specified by:
itemTypeName in class AbstractPackagedProperty<Class[]>
Returns:
String

asString

protected String asString(Object value)
Description copied from class: AbstractProperty
Return the value as a string that can be easily recognized and parsed when we see it again.

Overrides:
asString in class AbstractProperty<Class[]>
Parameters:
value - Object
Returns:
String

valueFrom

public Class<?>[] valueFrom(String valueString)
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:
valueString - String
Returns:
Object
See Also:
PropertyDescriptor.valueFrom(String)


Copyright © 2002-2015 InfoEther. All Rights Reserved.