Package net.sourceforge.pmd.properties
Class TypeMultiProperty
- java.lang.Object
-
- net.sourceforge.pmd.properties.TypeMultiProperty
-
- All Implemented Interfaces:
java.lang.Comparable<PropertyDescriptor<?>>
,MultiValuePropertyDescriptor<java.lang.Class>
,PackagedPropertyDescriptor<java.util.List<java.lang.Class>>
,PropertyDescriptor<java.util.List<java.lang.Class>>
@Deprecated public final class TypeMultiProperty extends java.lang.Object
Deprecated.Will be removed with 7.0.0 with no scheduled replacement yetDefines a property that supports multiple class types, even for primitive values! TODO - untested for array types- Author:
- Brian Remedios
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TypeMultiProperty.TypeMultiPBuilder
Deprecated.
-
Field Summary
Fields Modifier and Type Field Description protected PackagedPropertyModule<T>
module
Deprecated.-
Fields inherited from interface net.sourceforge.pmd.properties.MultiValuePropertyDescriptor
DEFAULT_DELIMITER, DEFAULT_NUMERIC_DELIMITER
-
Fields inherited from interface net.sourceforge.pmd.properties.PackagedPropertyDescriptor
MULTI_VALUE_DELIMITER, PACKAGE_NAME_DELIMITER
-
-
Constructor Summary
Constructors Constructor Description TypeMultiProperty(java.lang.String theName, java.lang.String theDescription, java.lang.String theTypeDefaults, java.lang.String[] legalPackageNames, float theUIOrder)
Deprecated.Constructor for TypeProperty.TypeMultiProperty(java.lang.String theName, java.lang.String theDescription, java.util.List<java.lang.Class> theDefaults, java.lang.String[] legalPackageNames, float theUIOrder)
Deprecated.Constructor for TypeProperty.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
addAttributesTo(java.util.Map<PropertyDescriptorField,java.lang.String> attributes)
Deprecated.Adds this property's attributes to the map.java.lang.String
asDelimitedString(java.util.List<V> values)
Deprecated.Formats the object onto a string suitable for storage within the property map.java.lang.String
asString(java.lang.Class value)
Deprecated.Returns a string representation of the value, even if it's null.java.util.Map<PropertyDescriptorField,java.lang.String>
attributeValuesById()
Returns a map representing all the property attributes of the receiver in string form.int
compareTo(PropertyDescriptor<?> otherProperty)
protected java.lang.Class
createFrom(java.lang.String toParse)
Deprecated.Parse a string and returns an instance of a single value (not a list).protected java.lang.String
defaultAsString()
Deprecated.Returns a string representation of the default value.java.util.List<V>
defaultValue()
Deprecated.Default value to use when the user hasn't specified one or when they wish to revert to a known-good state.java.lang.String
description()
Describes the property and the role it plays within the rule it is specified for.boolean
equals(java.lang.Object obj)
java.lang.String
errorFor(java.util.List<V> values)
Deprecated.Validation function that returns a diagnostic error message for a sample property value.static PropertyDescriptorBuilderConversionWrapper.MultiValue.Packaged<java.lang.Class,TypeMultiProperty.TypeMultiPBuilder>
extractor()
Deprecated.int
hashCode()
boolean
isDefinedExternally()
True if this descriptor was defined in the ruleset xml.boolean
isMultiValue()
Deprecated.Returns whether the property is multi-valued, i.e.java.lang.String[]
legalPackageNames()
Deprecated.Returns the legal package names.char
multiValueDelimiter()
Deprecated.Return the character being used to delimit multiple property values within a single string.java.lang.String
name()
The name of the property without spaces as it serves as the key into the property map.static TypeMultiProperty.TypeMultiPBuilder
named(java.lang.String name)
Deprecated.protected java.lang.String[]
packageNamesIn(java.util.Map<PropertyDescriptorField,java.lang.String> params)
Deprecated.int
preferredRowCount()
If the datatype is a String then return the preferred number of rows to allocate in the text widget, returns a value of one for all other types.java.lang.String
propertyErrorFor(Rule rule)
Deprecated.A convenience method that returns an error string if the rule holds onto a property value that has a problem.java.lang.String
toString()
java.lang.Class<java.lang.Class>
type()
Deprecated.Denotes the value datatype.float
uiOrder()
Denotes the relative order the property field should occupy if we are using an auto-generated UI to display and edit property values.protected java.lang.String
valueErrorFor(T value)
Deprecated.Checks a single value for a "missing value" error.java.util.List<java.lang.Class>
valueFrom(java.lang.String valueString)
Deprecated.Returns the value represented by this string.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sourceforge.pmd.properties.PropertyDescriptor
asDelimitedString, attributeValuesById, compareTo, defaultValue, description, errorFor, isDefinedExternally, isMultiValue, name, preferredRowCount, propertyErrorFor, uiOrder
-
-
-
-
Field Detail
-
module
protected final PackagedPropertyModule<T> module
Deprecated.
-
-
Constructor Detail
-
TypeMultiProperty
public TypeMultiProperty(java.lang.String theName, java.lang.String theDescription, java.util.List<java.lang.Class> theDefaults, java.lang.String[] legalPackageNames, float theUIOrder)
Deprecated.Constructor for TypeProperty.- Parameters:
theName
- StringtheDescription
- StringtheDefaults
- Class[]legalPackageNames
- String[]theUIOrder
- float- Throws:
java.lang.IllegalArgumentException
-
TypeMultiProperty
public TypeMultiProperty(java.lang.String theName, java.lang.String theDescription, java.lang.String theTypeDefaults, java.lang.String[] legalPackageNames, float theUIOrder)
Deprecated.Constructor for TypeProperty.- Parameters:
theName
- StringtheDescription
- StringtheTypeDefaults
- StringlegalPackageNames
- String[]theUIOrder
- float- Throws:
java.lang.IllegalArgumentException
-
-
Method Detail
-
type
public java.lang.Class<java.lang.Class> type()
Deprecated.Description copied from interface:PropertyDescriptor
Denotes the value datatype. For multi value properties, this is not the List class but the list's component class.- Returns:
- Class literal of the value type
-
asString
public java.lang.String asString(java.lang.Class value)
Deprecated.Returns a string representation of the value, even if it's null.- Parameters:
value
- The value to describe- Returns:
- A string representation of the value
-
createFrom
protected java.lang.Class createFrom(java.lang.String toParse)
Deprecated.Parse a string and returns an instance of a single value (not a list).- Parameters:
toParse
- String to parse- Returns:
- An instance of a value
-
valueFrom
public java.util.List<java.lang.Class> valueFrom(java.lang.String valueString)
Deprecated.Description copied from interface:PropertyDescriptor
Returns the value represented by this string.- Specified by:
valueFrom
in interfacePropertyDescriptor<java.util.List<java.lang.Class>>
- Parameters:
valueString
- The string to parse- Returns:
- The value represented by the string
-
extractor
public static PropertyDescriptorBuilderConversionWrapper.MultiValue.Packaged<java.lang.Class,TypeMultiProperty.TypeMultiPBuilder> extractor()
Deprecated.
-
named
public static TypeMultiProperty.TypeMultiPBuilder named(java.lang.String name)
Deprecated.
-
addAttributesTo
protected void addAttributesTo(java.util.Map<PropertyDescriptorField,java.lang.String> attributes)
Deprecated.Adds this property's attributes to the map. Subclasses can override this to add morePropertyDescriptorField
.- Parameters:
attributes
- The map to fill
-
valueErrorFor
protected java.lang.String valueErrorFor(T value)
Deprecated.Checks a single value for a "missing value" error.- Parameters:
value
- Value to check- Returns:
- A descriptive String of the error or null if there was none
-
legalPackageNames
public java.lang.String[] legalPackageNames()
Deprecated.Description copied from interface:PackagedPropertyDescriptor
Returns the legal package names.- Specified by:
legalPackageNames
in interfacePackagedPropertyDescriptor<T>
- Returns:
- The legal package names
-
packageNamesIn
protected java.lang.String[] packageNamesIn(java.util.Map<PropertyDescriptorField,java.lang.String> params)
Deprecated.
-
isMultiValue
public final boolean isMultiValue()
Deprecated.Description copied from interface:PropertyDescriptor
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 interfacePropertyDescriptor<V>
- Returns:
- boolean
-
propertyErrorFor
public java.lang.String propertyErrorFor(Rule rule)
Deprecated.Description copied from interface:PropertyDescriptor
A convenience method that returns an error string if the rule holds onto a property value that has a problem. Returns null otherwise.- Specified by:
propertyErrorFor
in interfacePropertyDescriptor<V>
- Parameters:
rule
- Rule- Returns:
- String
-
errorFor
public java.lang.String errorFor(java.util.List<V> values)
Deprecated.Description copied from interface:PropertyDescriptor
Validation function that returns a diagnostic error message for a sample property value. Returns null if the value is acceptable.- Specified by:
errorFor
in interfacePropertyDescriptor<V>
- Parameters:
values
- The value to check.- Returns:
- A diagnostic message.
-
defaultAsString
protected java.lang.String defaultAsString()
Deprecated.Returns a string representation of the default value.- Returns:
- A string representation of the default value.
-
defaultValue
public java.util.List<V> defaultValue()
Deprecated.Description copied from interface:PropertyDescriptor
Default value to use when the user hasn't specified one or when they wish to revert to a known-good state.- Specified by:
defaultValue
in interfacePropertyDescriptor<V>
- Returns:
- Object
-
multiValueDelimiter
public char multiValueDelimiter()
Deprecated.Description copied from interface:MultiValuePropertyDescriptor
Return the character being used to delimit multiple property values within a single string. You must ensure that this character does not appear within any rule property values to avoid deserialization errors.- Specified by:
multiValueDelimiter
in interfaceMultiValuePropertyDescriptor<V>
- Returns:
- char
-
asDelimitedString
public final java.lang.String asDelimitedString(java.util.List<V> values)
Deprecated.Description copied from interface:PropertyDescriptor
Formats the object onto a string suitable for storage within the property map.- Specified by:
asDelimitedString
in interfacePropertyDescriptor<V>
- Parameters:
values
- Object- Returns:
- String
-
description
public java.lang.String description()
Description copied from interface:PropertyDescriptor
Describes the property and the role it plays within the rule it is specified for. Could be used in a tooltip.- Specified by:
description
in interfacePropertyDescriptor<T>
- Returns:
- String
-
uiOrder
public float uiOrder()
Description copied from interface:PropertyDescriptor
Denotes the relative order the property field should occupy if we are using an auto-generated UI to display and edit property values. If the value returned has a non-zero fractional part then this is can be used to place adjacent fields on the same row.- Specified by:
uiOrder
in interfacePropertyDescriptor<T>
- Returns:
- The relative order compared to other properties of the same rule
-
compareTo
public final int compareTo(PropertyDescriptor<?> otherProperty)
- Specified by:
compareTo
in interfacejava.lang.Comparable<T>
- Specified by:
compareTo
in interfacePropertyDescriptor<T>
-
preferredRowCount
public int preferredRowCount()
Description copied from interface:PropertyDescriptor
If the datatype is a String then return the preferred number of rows to allocate in the text widget, returns a value of one for all other types. Useful for multi-line XPATH editors.- Specified by:
preferredRowCount
in interfacePropertyDescriptor<T>
- Returns:
- int
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
name
public java.lang.String name()
Description copied from interface:PropertyDescriptor
The name of the property without spaces as it serves as the key into the property map.- Specified by:
name
in interfacePropertyDescriptor<T>
- Returns:
- String
-
attributeValuesById
public final java.util.Map<PropertyDescriptorField,java.lang.String> attributeValuesById()
Description copied from interface:PropertyDescriptor
Returns a map representing all the property attributes of the receiver in string form.- Specified by:
attributeValuesById
in interfacePropertyDescriptor<T>
- Returns:
- map
-
isDefinedExternally
public boolean isDefinedExternally()
Description copied from interface:PropertyDescriptor
True if this descriptor was defined in the ruleset xml. This precision is necessary for theRuleSetWriter
to write out the property correctly: if it was defined externally, then its definition must be written out, otherwise only its value.- Specified by:
isDefinedExternally
in interfacePropertyDescriptor<T>
- Returns:
- True if the descriptor was defined in xml
-
-