@OpenApiAll public class NumberProperty extends Property
Modifier and Type | Field and Description |
---|---|
static int |
DOUBLE
Number type is double.
|
static int |
FLOAT
Number type is float.
|
static int |
INT
Number type is integer.
|
static java.lang.String |
PATTERN
Patters which is used to format the number.
|
DEFAULT_PROPERTY_RESOURCE_PROVIDER, EDITABLE, mAdditionalProperties, mDescriptionID, mEditable, mGroupName, mID, mResourceProvider, mSources, mSupport, mUndefinedState, mValue, NULL, NULL_ID_PROPERTY_RESOURCE_PROVIDER, UNDEFINED, VALUE
Constructor and Description |
---|
NumberProperty()
Default constructor.
|
NumberProperty(java.lang.String id,
double value,
double low,
double high)
The property constructor.
|
NumberProperty(java.lang.String id,
java.lang.Double value,
int type,
double low,
double high)
The property constructor.
|
NumberProperty(java.lang.String id,
float value,
double low,
double high)
The property constructor.
|
NumberProperty(java.lang.String id,
int value,
double low,
double high)
The property constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(PropertyVisitor v)
Accepts the given visitor.
|
java.lang.String |
getClassType()
Returns property class type.
|
double |
getDouble()
Returns value as double (primitive type).
|
java.lang.Double |
getDoubleObject()
Returns value as Double object.
|
float |
getFloat()
Returns value as float (primitive type).
|
double |
getHighRange()
Returns highest range of the value.
|
int |
getInteger()
Returns value as int (primitive type).
|
long |
getLong()
Returns value as long (primitive type).
|
double |
getLowRange()
Returns lowest range of the number value.
|
int |
getNumberType()
Returns type of the number.
|
static java.lang.String |
getPattern(Property property) |
static java.lang.String |
getStringRepresentation(int type,
java.lang.Double value) |
static java.lang.String |
getStringRepresentation(int type,
java.lang.Double value,
java.lang.String pattern) |
java.lang.Object |
getValue()
Returns properties value.
|
java.lang.String |
getValueStringRepresentation()
Returns value's string representation.
|
static java.lang.String |
hasError(NumberProperty property,
java.lang.String newNumber) |
boolean |
isSoftRange() |
void |
setHighRange(double range)
Returns highest range of the value.
|
void |
setLowRange(double range)
Returns lowest range of the value.
|
void |
setNumberType(int type)
Sets type of the number.
|
void |
setSoftRange(boolean softRange) |
void |
setValue(double value)
Sets value as primitive double type.
|
void |
setValue(float value)
Sets value as primitive float type.
|
void |
setValue(int value)
Sets value as primitive integer.
|
void |
setValue(java.lang.Object value)
Sets new property value.
|
static java.lang.Double |
toDouble(java.lang.Number number) |
_isFrozen, _setFrozen, addPropertyChangeListener, addSource, addSources, areValuesEqual, clone, createCellEditor, createEditor, createTableCellRenderer, equals, firePropertyChange, generateDefaultDescriptionID, getAdditionalProperties, getAdditionalProperty, getDescription, getDescriptionID, getGroup, getID, getName, getNonEditableReason, getProjectFromSourcesOrActive, getPureDescription, getResourceProvider, getResourceProviderID, getSources, getUndefinedString, getUndefinedString, hashCode, isEditable, isUndefinedState, removePropertyChangeListener, setAdditionalProperties, setAdditionalProperty, setDescription, setDescriptionID, setEditable, setGroup, setID, setNonEditableReason, setResourceProvider, setResourceProviderID, setSources, setUndefinedState, toString
public static final int INT
public static final int DOUBLE
public static final int FLOAT
public static java.lang.String PATTERN
public NumberProperty()
public NumberProperty(java.lang.String id, java.lang.Double value, int type, double low, double high)
id
- the ID of property.value
- the number value of the property.type
- the number type (INT, DOUBLE or FLOAT).low
- lowest range of the number.high
- highest range of the number.public NumberProperty(java.lang.String id, int value, double low, double high)
id
- the ID of property.value
- the value of the property.low
- lowest range of the number.high
- highest range of the number.public NumberProperty(java.lang.String id, float value, double low, double high)
id
- the ID of property.value
- the value of the property.low
- lowest range of the number.high
- highest range of the number.public NumberProperty(java.lang.String id, double value, double low, double high)
id
- the ID of property.value
- the value of the property.low
- lowest range of the number.high
- highest range of the number.public java.lang.String getValueStringRepresentation()
getValueStringRepresentation
in class Property
@CheckForNull public static java.lang.String getPattern(Property property)
public static java.lang.String getStringRepresentation(int type, java.lang.Double value, @CheckForNull java.lang.String pattern)
public static java.lang.String getStringRepresentation(int type, java.lang.Double value)
public static java.lang.Double toDouble(java.lang.Number number)
public void accept(PropertyVisitor v) throws java.lang.Exception
accept
in interface PropertyVisitorAcceptor
accept
in class Property
v
- the PropertyVisitor.java.lang.Exception
public int getInteger()
public long getLong()
public double getDouble()
public float getFloat()
public java.lang.Double getDoubleObject()
public void setValue(int value)
value
- a new integer value.public void setValue(double value)
value
- a new double value.public void setValue(float value)
value
- a new float value.public void setValue(java.lang.Object value)
Property
PropertyChangeEvent
with propertyName - property
ID, newValue and oldValue.public java.lang.Object getValue()
Property
public java.lang.String getClassType()
getClassType
in interface PropertyVisitorAcceptor
getClassType
in class Property
PropertyID.NUMBER_PROPERTY
public int getNumberType()
public void setNumberType(int type)
type
- the number type - INT, DOUBLE or FLOAT.public double getLowRange()
public double getHighRange()
public void setLowRange(double range)
range
- the lowest range.public void setHighRange(double range)
range
- the highest range.public static java.lang.String hasError(NumberProperty property, java.lang.String newNumber) throws java.lang.NumberFormatException
java.lang.NumberFormatException
public boolean isSoftRange()
public void setSoftRange(boolean softRange)
softRange
- Property is allowed to cross the range boundaries. Default is false.