public final class FloatProperty
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
FloatProperty.FloatPBuilder |
Constructor and Description |
---|
FloatProperty(java.lang.String theName,
java.lang.String theDescription,
java.lang.Float min,
java.lang.Float max,
java.lang.Float theDefault,
float theUIOrder)
Constructor that limits itself to a single value within the specified limits.
|
FloatProperty(java.lang.String theName,
java.lang.String theDescription,
java.lang.String minStr,
java.lang.String maxStr,
java.lang.String defaultStr,
float theUIOrder)
Deprecated.
will be removed in 7.0.0
|
Modifier and Type | Method and Description |
---|---|
protected void |
addAttributesTo(java.util.Map<PropertyDescriptorField,java.lang.String> attributes)
Adds this property's attributes to the map.
|
java.lang.String |
asDelimitedString(T value)
Formats the object onto a string suitable for storage within the property map.
|
protected java.lang.String |
asString(T value)
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.Float |
createFrom(java.lang.String value)
Parse a string and returns an instance of a value.
|
protected java.lang.String |
defaultAsString()
Returns a string representation of the default value.
|
T |
defaultValue()
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(T value)
Validation function that returns a diagnostic error message for a sample property value.
|
int |
hashCode() |
boolean |
isDefinedExternally()
True if this descriptor was defined in the ruleset xml.
|
boolean |
isMultiValue()
Returns whether the property is multi-valued, i.e.
|
java.lang.Number |
lowerLimit()
Returns the minimum value that instances of the property can have.
|
java.lang.String |
name()
The name of the property without spaces as it serves as the key into the property map.
|
static FloatProperty.FloatPBuilder |
named(java.lang.String name) |
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)
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.Float> |
type()
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.
|
java.lang.Number |
upperLimit()
Returns the maximum value that instances of the property can have.
|
protected java.lang.String |
valueErrorFor(T value)
Checks the value for an error.
|
T |
valueFrom(java.lang.String valueString)
Returns the value represented by this string.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
asDelimitedString, attributeValuesById, defaultValue, description, errorFor, isDefinedExternally, isMultiValue, name, preferredRowCount, propertyErrorFor, uiOrder, valueFrom
public FloatProperty(java.lang.String theName, java.lang.String theDescription, java.lang.String minStr, java.lang.String maxStr, java.lang.String defaultStr, float theUIOrder)
theName
- NametheDescription
- DescriptionminStr
- Minimum value of the propertymaxStr
- Maximum value of the propertydefaultStr
- Default valuetheUIOrder
- UI orderjava.lang.IllegalArgumentException
- if min > max or one of the defaults is not between the boundspublic FloatProperty(java.lang.String theName, java.lang.String theDescription, java.lang.Float min, java.lang.Float max, java.lang.Float theDefault, float theUIOrder)
theName
- NametheDescription
- Descriptionmin
- Minimum value of the propertymax
- Maximum value of the propertytheDefault
- Default valuetheUIOrder
- UI orderjava.lang.IllegalArgumentException
- if min > max or one of the defaults is not between the boundspublic java.lang.Class<java.lang.Float> type()
PropertyDescriptor
protected java.lang.Float createFrom(java.lang.String value)
value
- String to parsepublic static FloatProperty.FloatPBuilder named(java.lang.String name)
protected java.lang.String valueErrorFor(T value)
value
- Value to checkpublic java.lang.Number lowerLimit()
NumericPropertyDescriptor
lowerLimit
in interface NumericPropertyDescriptor<T extends java.lang.Number>
public java.lang.Number upperLimit()
NumericPropertyDescriptor
upperLimit
in interface NumericPropertyDescriptor<T extends java.lang.Number>
protected void addAttributesTo(java.util.Map<PropertyDescriptorField,java.lang.String> attributes)
PropertyDescriptorField
.attributes
- The map to fillpublic final T defaultValue()
PropertyDescriptor
defaultValue
in interface PropertyDescriptor<T>
public final boolean isMultiValue()
PropertyDescriptor
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.
isMultiValue
in interface PropertyDescriptor<T>
public java.lang.String asDelimitedString(T value)
PropertyDescriptor
asDelimitedString
in interface PropertyDescriptor<T>
value
- Objectprotected java.lang.String asString(T value)
value
- The value to describepublic java.lang.String propertyErrorFor(Rule rule)
PropertyDescriptor
propertyErrorFor
in interface PropertyDescriptor<T>
rule
- Rulepublic java.lang.String errorFor(T value)
PropertyDescriptor
errorFor
in interface PropertyDescriptor<T>
value
- The value to check.protected final java.lang.String defaultAsString()
public final T valueFrom(java.lang.String valueString) throws java.lang.IllegalArgumentException
PropertyDescriptor
valueFrom
in interface PropertyDescriptor<T>
valueString
- The string to parsejava.lang.IllegalArgumentException
- if the given string cannot be parsedpublic java.lang.String description()
PropertyDescriptor
description
in interface PropertyDescriptor<T>
public float uiOrder()
PropertyDescriptor
Example:
name -> 0.0 description 1.0 minValue -> 2.0 maxValue -> 2.1
name: [ ] description: [ ] minimum: [ ] maximum: [ ]
uiOrder
in interface PropertyDescriptor<T>
public final int compareTo(PropertyDescriptor<?> otherProperty)
compareTo
in interface java.lang.Comparable<PropertyDescriptor<?>>
public int preferredRowCount()
PropertyDescriptor
preferredRowCount
in interface PropertyDescriptor<T>
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String name()
PropertyDescriptor
name
in interface PropertyDescriptor<T>
public final java.util.Map<PropertyDescriptorField,java.lang.String> attributeValuesById()
PropertyDescriptor
attributeValuesById
in interface PropertyDescriptor<T>
public boolean isDefinedExternally()
PropertyDescriptor
RuleSetWriter
to write out the property correctly: if it was defined externally, then its definition must be written out,
otherwise only its value.isDefinedExternally
in interface PropertyDescriptor<T>
Copyright © 2002–2018 PMD. All rights reserved.