net.sourceforge.pmd.lang.rule.properties
Class AbstractNumericProperty<T>

java.lang.Object
  extended by net.sourceforge.pmd.lang.rule.properties.AbstractProperty<T>
      extended by net.sourceforge.pmd.lang.rule.properties.AbstractScalarProperty<T>
          extended by net.sourceforge.pmd.lang.rule.properties.AbstractNumericProperty<T>
Type Parameters:
T -
All Implemented Interfaces:
Comparable<PropertyDescriptor<?>>, NumericPropertyDescriptor<T>, PropertyDescriptor<T>
Direct Known Subclasses:
AbstractMultiNumericProperty, DoubleProperty, FloatProperty, IntegerProperty, LongProperty

public abstract class AbstractNumericProperty<T>
extends AbstractScalarProperty<T>
implements NumericPropertyDescriptor<T>

Maintains a pair of boundary limit values between which all values managed by the subclasses must fit.

Author:
Brian Remedios

Field Summary
static Map<String,Boolean> NUMBER_FIELD_TYPES_BY_KEY
           
 
Fields inherited from class net.sourceforge.pmd.lang.rule.properties.AbstractProperty
DEFAULT_DELIMITER, DEFAULT_NUMERIC_DELIMITER
 
Constructor Summary
protected AbstractNumericProperty(String theName, String theDescription, Number lower, Number upper, T theDefault, float theUIOrder)
           
 
Method Summary
protected  void addAttributesTo(Map<String,String> attributes)
          Method addAttributesTo.
protected  String defaultAsString()
           
 Number lowerLimit()
          Returns the minimum value that instances of the property can have
 String rangeString()
           
 Number upperLimit()
          Returns the maximum value that instances of the property can have
protected  String valueErrorFor(Object value)
          Returns a string describing any error the value may have when characterized by the receiver.
 
Methods inherited from class net.sourceforge.pmd.lang.rule.properties.AbstractScalarProperty
arrayFor, createFrom, valueFrom
 
Methods inherited from class net.sourceforge.pmd.lang.rule.properties.AbstractProperty
areEqual, asDelimitedString, asDelimitedString, asString, 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
 
Methods inherited from interface net.sourceforge.pmd.PropertyDescriptor
asDelimitedString, attributeValuesById, choices, defaultValue, description, errorFor, isMultiValue, isRequired, multiValueDelimiter, name, preferredRowCount, propertyErrorFor, type, uiOrder, valueFrom
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

NUMBER_FIELD_TYPES_BY_KEY

public static final Map<String,Boolean> NUMBER_FIELD_TYPES_BY_KEY
Constructor Detail

AbstractNumericProperty

protected AbstractNumericProperty(String theName,
                                  String theDescription,
                                  Number lower,
                                  Number upper,
                                  T theDefault,
                                  float theUIOrder)
Parameters:
theName -
theDescription -
lower -
upper -
theDefault -
theUIOrder -
Throws:
IllegalArgumentException
Method Detail

lowerLimit

public Number lowerLimit()
Returns the minimum value that instances of the property can have

Specified by:
lowerLimit in interface NumericPropertyDescriptor<T>
Returns:
The minimum value.
See Also:
NumericPropertyDescriptor.lowerLimit()

defaultAsString

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

upperLimit

public Number upperLimit()
Returns the maximum value that instances of the property can have

Specified by:
upperLimit in interface NumericPropertyDescriptor<T>
Returns:
The maximum value.
See Also:
NumericPropertyDescriptor.upperLimit()

rangeString

public String rangeString()
Returns:
String

valueErrorFor

protected String valueErrorFor(Object value)
Returns a string describing any error the value may have when characterized by the receiver.

Overrides:
valueErrorFor in class AbstractProperty<T>
Parameters:
value - Object
Returns:
String

addAttributesTo

protected void addAttributesTo(Map<String,String> attributes)
Method addAttributesTo.

Overrides:
addAttributesTo in class AbstractProperty<T>
Parameters:
attributes - Map


Copyright © 2002-2015 InfoEther. All Rights Reserved.