|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.pmd.lang.rule.properties.AbstractProperty<T> net.sourceforge.pmd.lang.rule.properties.AbstractPackagedProperty<Method> net.sourceforge.pmd.lang.rule.properties.MethodProperty
public class MethodProperty
Defines a property type that can specify a single method 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" ].
Field Summary | |
---|---|
static char |
CLASS_METHOD_DELIMITER
|
static PropertyDescriptorFactory |
FACTORY
|
static char |
METHOD_ARG_DELIMITER
|
static char[] |
METHOD_GROUP_DELIMITERS
|
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 | |
---|---|
MethodProperty(String theName,
String theDescription,
Method theDefault,
String[] legalPackageNames,
float theUIOrder)
Constructor for MethodProperty. |
|
MethodProperty(String theName,
String theDescription,
String defaultMethodStr,
Map<String,String> otherParams,
float theUIOrder)
Constructor for MethodProperty. |
|
MethodProperty(String theName,
String theDescription,
String defaultMethodStr,
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. |
static String |
asStringFor(Method method)
Return the value of `method' as a string that can be easily recognized and parsed when we see it again. |
static void |
asStringOn(Method method,
StringBuilder sb)
Serializes the method signature onto the specified buffer. |
protected String |
defaultAsString()
|
protected String |
itemTypeName()
Method itemTypeName. |
static Method |
methodFrom(String methodStr)
|
static Method |
methodFrom(String methodNameAndArgTypes,
char classMethodDelimiter,
char methodArgDelimiter)
Returns the method specified within the string argument after parsing out its source class and any optional arguments. |
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.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 |
---|
public static final char CLASS_METHOD_DELIMITER
public static final char METHOD_ARG_DELIMITER
public static final char[] METHOD_GROUP_DELIMITERS
public static final PropertyDescriptorFactory FACTORY
Constructor Detail |
---|
public MethodProperty(String theName, String theDescription, Method theDefault, String[] legalPackageNames, float theUIOrder)
theName
- StringtheDescription
- StringtheDefault
- MethodlegalPackageNames
- String[]theUIOrder
- float
IllegalArgumentException
public MethodProperty(String theName, String theDescription, String defaultMethodStr, String[] legalPackageNames, float theUIOrder)
theName
- StringtheDescription
- StringdefaultMethodStr
- StringlegalPackageNames
- String[]theUIOrder
- float
IllegalArgumentException
public MethodProperty(String theName, String theDescription, String defaultMethodStr, Map<String,String> otherParams, float theUIOrder)
theName
- StringtheDescription
- StringdefaultMethodStr
- StringotherParams
- MaptheUIOrder
- float
IllegalArgumentException
Method Detail |
---|
public static String asStringFor(Method method)
method
- the method to convert
protected String defaultAsString()
defaultAsString
in class AbstractProperty<Method>
public static void asStringOn(Method method, StringBuilder sb)
method
- Methodsb
- StringBuilderpublic static Method methodFrom(String methodNameAndArgTypes, char classMethodDelimiter, char methodArgDelimiter)
methodNameAndArgTypes
- classMethodDelimiter
- methodArgDelimiter
-
public static Method methodFrom(String methodStr)
methodStr
- String
protected String asString(Object value)
asString
in class AbstractProperty<Method>
value
- Object
protected String packageNameOf(Object item)
packageNameOf
in class AbstractPackagedProperty<Method>
item
- Object
protected String itemTypeName()
AbstractPackagedProperty
itemTypeName
in class AbstractPackagedProperty<Method>
public Class<Method> type()
PropertyDescriptor
PropertyDescriptor.type()
public Method valueFrom(String valueString) throws IllegalArgumentException
PropertyDescriptor
valueString
- String
IllegalArgumentException
PropertyDescriptor.valueFrom(String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |