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

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

public class TypeProperty
extends AbstractPackagedProperty<Class>

Defines a property that supports single 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.AbstractPackagedProperty
PACKAGED_FIELD_TYPES_BY_KEY
 
Fields inherited from class net.sourceforge.pmd.lang.rule.properties.AbstractProperty
DEFAULT_DELIMITER, DEFAULT_NUMERIC_DELIMITER
 
Constructor Summary
TypeProperty(String theName, String theDescription, Class<?> theDefault, String[] legalPackageNames, float theUIOrder)
          Constructor for TypeProperty.
TypeProperty(String theName, String theDescription, String defaultTypeStr, Map<String,String> otherParams, float theUIOrder)
           
TypeProperty(String theName, String theDescription, String defaultTypeStr, String[] legalPackageNames, float theUIOrder)
           
 
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 defaultAsString()
           
protected  String itemTypeName()
          Method itemTypeName.
protected  String packageNameOf(Object item)
          Method packageNameOf.
 Class<Class> type()
          Denotes the value datatype.
 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.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, isMultiValue, 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

TypeProperty

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

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

TypeProperty

public TypeProperty(String theName,
                    String theDescription,
                    String defaultTypeStr,
                    String[] legalPackageNames,
                    float theUIOrder)
Parameters:
theName - String
theDescription - String
defaultTypeStr - String
legalPackageNames - String[]
theUIOrder - float
Throws:
IllegalArgumentException

TypeProperty

public TypeProperty(String theName,
                    String theDescription,
                    String defaultTypeStr,
                    Map<String,String> otherParams,
                    float theUIOrder)
Parameters:
theName - String
theDescription - String
defaultTypeStr - String
otherParams - Map
theUIOrder - float
Throws:
IllegalArgumentException
Method Detail

defaultAsString

protected String defaultAsString()
Overrides:
defaultAsString in class AbstractProperty<Class>
Returns:
String

packageNameOf

protected String packageNameOf(Object item)
Method packageNameOf.

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.