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

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<Method[]>
              extended by net.sourceforge.pmd.lang.rule.properties.MethodMultiProperty
All Implemented Interfaces:
Comparable<PropertyDescriptor<?>>, PropertyDescriptor<Method[]>

public class MethodMultiProperty
extends AbstractMultiPackagedProperty<Method[]>

Defines a property type that can specify multiple methods to use as part of a rule. Rule developers can limit the rules to those within designated packages per the 'legalPackages' argument in the constructor which can be an array of partial package names, i.e., ["java.lang", "com.mycompany" ].

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
MethodMultiProperty(String theName, String theDescription, Method[] theDefaults, String[] legalPackageNames, float theUIOrder)
          Constructor for MethodProperty.
MethodMultiProperty(String theName, String theDescription, String methodDefaults, Map<String,String> otherParams, float theUIOrder)
          Constructor for MethodProperty.
MethodMultiProperty(String theName, String theDescription, String methodDefaults, String[] legalPackageNames, float theUIOrder)
          Constructor for MethodProperty.
 
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.
static Method[] methodsFrom(String methodsStr)
           
protected  String packageNameOf(Object item)
           
 Class<Method[]> type()
          Denotes the value datatype.
 Method[] 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

MethodMultiProperty

public MethodMultiProperty(String theName,
                           String theDescription,
                           Method[] theDefaults,
                           String[] legalPackageNames,
                           float theUIOrder)
Constructor for MethodProperty.

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

MethodMultiProperty

public MethodMultiProperty(String theName,
                           String theDescription,
                           String methodDefaults,
                           String[] legalPackageNames,
                           float theUIOrder)
Constructor for MethodProperty.

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

MethodMultiProperty

public MethodMultiProperty(String theName,
                           String theDescription,
                           String methodDefaults,
                           Map<String,String> otherParams,
                           float theUIOrder)
Constructor for MethodProperty.

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

methodsFrom

public static Method[] methodsFrom(String methodsStr)
Parameters:
methodsStr - String
Returns:
Method[]

asString

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

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

packageNameOf

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

itemTypeName

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

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

type

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

Returns:
Class
See Also:
PropertyDescriptor.type()

valueFrom

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


Copyright © 2002-2016 InfoEther. All Rights Reserved.