Package net.sourceforge.pmd.properties
Class LongProperty
- java.lang.Object
-
- net.sourceforge.pmd.properties.LongProperty
-
- All Implemented Interfaces:
java.lang.Comparable<PropertyDescriptor<?>>,NumericPropertyDescriptor<java.lang.Long>,PropertyDescriptor<java.lang.Long>,SingleValuePropertyDescriptor<java.lang.Long>
@Deprecated public final class LongProperty extends java.lang.ObjectDeprecated.Use aPropertyDescriptor<Long>instead. A builder is available fromPropertyFactory.longIntProperty(String). This class will be removed in 7.0.0.Single valued long property.- Version:
- Refactored June 2017 (6.0.0)
- Author:
- Brian Remedios, Clément Fournier
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLongProperty.LongPBuilderDeprecated.
-
Constructor Summary
Constructors Constructor Description LongProperty(java.lang.String theName, java.lang.String theDescription, java.lang.Long min, java.lang.Long max, java.lang.Long theDefault, float theUIOrder)Deprecated.LongProperty(java.lang.String theName, java.lang.String theDescription, java.lang.String minStr, java.lang.String maxStr, java.lang.String defaultStr, float theUIOrder)Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddAttributesTo(java.util.Map<PropertyDescriptorField,java.lang.String> attributes)Deprecated.Adds this property's attributes to the map.java.lang.StringasDelimitedString(T value)Deprecated.Formats the object onto a string suitable for storage within the property map.protected java.lang.StringasString(T 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.intcompareTo(PropertyDescriptor<?> otherProperty)protected java.lang.LongcreateFrom(java.lang.String toParse)Deprecated.Parse a string and returns an instance of a value.protected java.lang.StringdefaultAsString()Deprecated.Returns a string representation of the default value.TdefaultValue()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.Stringdescription()Describes the property and the role it plays within the rule it is specified for.booleanequals(java.lang.Object obj)java.lang.StringerrorFor(T value)Deprecated.Validation function that returns a diagnostic error message for a sample property value.inthashCode()booleanisDefinedExternally()True if this descriptor was defined in the ruleset xml.booleanisMultiValue()Deprecated.Returns whether the property is multi-valued, i.e.java.lang.NumberlowerLimit()Deprecated.Returns the minimum value that instances of the property can have.java.lang.Stringname()The name of the property without spaces as it serves as the key into the property map.static LongProperty.LongPBuildernamed(java.lang.String name)Deprecated.intpreferredRowCount()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.StringpropertyErrorFor(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.StringtoString()java.lang.Class<java.lang.Long>type()Deprecated.Denotes the value datatype.floatuiOrder()Denotes the relative order the property field should occupy if we are using an auto-generated UI to display and edit property values.java.lang.NumberupperLimit()Deprecated.Returns the maximum value that instances of the property can have.protected java.lang.StringvalueErrorFor(T value)Deprecated.Checks the value for an error.TvalueFrom(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, valueFrom
-
-
-
-
Constructor Detail
-
LongProperty
@Deprecated public LongProperty(java.lang.String theName, java.lang.String theDescription, java.lang.String minStr, java.lang.String maxStr, java.lang.String defaultStr, float theUIOrder)Deprecated.Constructor for LongProperty that limits itself to a single value within the specified limits. Converts string arguments into the Long values.- Parameters:
theName- NametheDescription- DescriptionminStr- Minimum value of the propertymaxStr- Maximum value of the propertydefaultStr- Default valuetheUIOrder- UI order- Throws:
java.lang.IllegalArgumentException- if min > max or one of the defaults is not between the bounds
-
LongProperty
@Deprecated public LongProperty(java.lang.String theName, java.lang.String theDescription, java.lang.Long min, java.lang.Long max, java.lang.Long theDefault, float theUIOrder)Deprecated.Constructor that limits itself to a single value within the specified limits.- Parameters:
theName- NametheDescription- Descriptionmin- Minimum value of the propertymax- Maximum value of the propertytheDefault- Default valuetheUIOrder- UI order- Throws:
java.lang.IllegalArgumentException- if min > max or one of the defaults is not between the bounds
-
-
Method Detail
-
type
public java.lang.Class<java.lang.Long> type()
Deprecated.Description copied from interface:PropertyDescriptorDenotes 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
-
createFrom
protected java.lang.Long createFrom(java.lang.String toParse)
Deprecated.Parse a string and returns an instance of a value.- Parameters:
toParse- String to parse- Returns:
- An instance of a value
-
named
@Deprecated public static LongProperty.LongPBuilder named(java.lang.String name)
Deprecated.
-
valueErrorFor
protected java.lang.String valueErrorFor(T value)
Deprecated.Checks the value for an error.- Parameters:
value- Value to check- Returns:
- A diagnostic error message, or null if there's no problem
-
lowerLimit
public java.lang.Number lowerLimit()
Deprecated.Description copied from interface:NumericPropertyDescriptorReturns the minimum value that instances of the property can have.- Specified by:
lowerLimitin interfaceNumericPropertyDescriptor<T extends java.lang.Number>- Returns:
- Number
-
upperLimit
public java.lang.Number upperLimit()
Deprecated.Description copied from interface:NumericPropertyDescriptorReturns the maximum value that instances of the property can have.- Specified by:
upperLimitin interfaceNumericPropertyDescriptor<T extends java.lang.Number>- Returns:
- Number
-
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
-
defaultValue
public final T defaultValue()
Deprecated.Description copied from interface:PropertyDescriptorDefault value to use when the user hasn't specified one or when they wish to revert to a known-good state.- Specified by:
defaultValuein interfacePropertyDescriptor<T>- Returns:
- Object
-
isMultiValue
public final boolean isMultiValue()
Deprecated.Description copied from interface:PropertyDescriptorReturns 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:
isMultiValuein interfacePropertyDescriptor<T>- Returns:
- boolean
-
asDelimitedString
public java.lang.String asDelimitedString(T value)
Deprecated.Description copied from interface:PropertyDescriptorFormats the object onto a string suitable for storage within the property map.- Specified by:
asDelimitedStringin interfacePropertyDescriptor<T>- Parameters:
value- Object- Returns:
- String
-
asString
protected java.lang.String asString(T 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
-
propertyErrorFor
public java.lang.String propertyErrorFor(Rule rule)
Deprecated.Description copied from interface:PropertyDescriptorA convenience method that returns an error string if the rule holds onto a property value that has a problem. Returns null otherwise.- Specified by:
propertyErrorForin interfacePropertyDescriptor<T>- Parameters:
rule- Rule- Returns:
- String
-
errorFor
public java.lang.String errorFor(T value)
Deprecated.Description copied from interface:PropertyDescriptorValidation function that returns a diagnostic error message for a sample property value. Returns null if the value is acceptable.- Specified by:
errorForin interfacePropertyDescriptor<T>- Parameters:
value- The value to check.- Returns:
- A diagnostic message.
-
defaultAsString
protected final java.lang.String defaultAsString()
Deprecated.Returns a string representation of the default value.- Returns:
- A string representation of the default value.
-
valueFrom
public final T valueFrom(java.lang.String valueString) throws java.lang.IllegalArgumentExceptionDeprecated.Description copied from interface:PropertyDescriptorReturns the value represented by this string.- Specified by:
valueFromin interfacePropertyDescriptor<T>- Parameters:
valueString- The string to parse- Returns:
- The value represented by the string
- Throws:
java.lang.IllegalArgumentException- if the given string cannot be parsed
-
description
public java.lang.String description()
Description copied from interface:PropertyDescriptorDescribes the property and the role it plays within the rule it is specified for. Could be used in a tooltip.- Specified by:
descriptionin interfacePropertyDescriptor<T>- Returns:
- String
-
uiOrder
public float uiOrder()
Description copied from interface:PropertyDescriptorDenotes 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:
uiOrderin interfacePropertyDescriptor<T>- Returns:
- The relative order compared to other properties of the same rule
-
compareTo
public final int compareTo(PropertyDescriptor<?> otherProperty)
- Specified by:
compareToin interfacejava.lang.Comparable<T>- Specified by:
compareToin interfacePropertyDescriptor<T>
-
preferredRowCount
public int preferredRowCount()
Description copied from interface:PropertyDescriptorIf 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:
preferredRowCountin interfacePropertyDescriptor<T>- Returns:
- int
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
name
public java.lang.String name()
Description copied from interface:PropertyDescriptorThe name of the property without spaces as it serves as the key into the property map.- Specified by:
namein interfacePropertyDescriptor<T>- Returns:
- String
-
attributeValuesById
public final java.util.Map<PropertyDescriptorField,java.lang.String> attributeValuesById()
Description copied from interface:PropertyDescriptorReturns a map representing all the property attributes of the receiver in string form.- Specified by:
attributeValuesByIdin interfacePropertyDescriptor<T>- Returns:
- map
-
isDefinedExternally
public boolean isDefinedExternally()
Description copied from interface:PropertyDescriptorTrue if this descriptor was defined in the ruleset xml. This precision is necessary for theRuleSetWriterto write out the property correctly: if it was defined externally, then its definition must be written out, otherwise only its value.- Specified by:
isDefinedExternallyin interfacePropertyDescriptor<T>- Returns:
- True if the descriptor was defined in xml
-
-