Joda System API

org.joda.property.impl.type
Class AbstractNumericProperty

java.lang.Object
  |
  +--org.joda.property.impl.AbstractModelElement
        |
        +--org.joda.property.impl.AbstractProperty
              |
              +--org.joda.property.impl.type.AbstractNumericProperty
All Implemented Interfaces:
java.lang.Comparable, DataProperty, InitializableProperty, ModelElement, NumericProperty, Property, Property.Internal, java.io.Serializable
Direct Known Subclasses:
AbstractDoubleProperty, AbstractIntegerProperty, AbstractLongProperty, DefaultDecimalProperty

public abstract class AbstractNumericProperty
extends AbstractProperty
implements NumericProperty

Abstract class useful for Numeric property implementations.

Author:
Stephen Colebourne
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.joda.property.Property
Property.Internal
 
Field Summary
 
Fields inherited from interface org.joda.property.type.NumericProperty
DEFAULT_TYPE
 
Constructor Summary
AbstractNumericProperty()
          Constructor
 
Method Summary
 int compareTo(double anotherValue)
          Compare the property's value to the passed in value.
 int compareTo(long anotherValue)
          Compare the property's value to the passed in value.
 double doubleValue()
          Get the property's value as a double.
 boolean equals(double anotherValue)
          Is the property's value equal to the passed in value.
 boolean equals(long anotherValue)
          Is the property's value equal to the passed in value.
 float floatValue()
          Get the property's value as a float.
protected  java.lang.Number getInternal()
          Get the value from the data store
 int intValue()
          Get the property's value as an int.
 boolean isGreaterThan(double anotherValue)
          Is the property's value greater than the passed in value.
 boolean isGreaterThan(long anotherValue)
          Is the property's value greater than the passed in value.
 boolean isGreaterThan(java.lang.Object anotherValue)
          Is the property's value greater than the passed in value.
 boolean isLessThan(double anotherValue)
          Is the property's value less than the passed in value.
 boolean isLessThan(long anotherValue)
          Is the property's value less than the passed in value.
 boolean isLessThan(java.lang.Object anotherValue)
          Is the property's value less than the passed in value.
 long longValue()
          Get the property's value as a long.
protected  void setInternal(java.lang.Number newValue)
          Set the value to the data store
 java.lang.Double toDouble()
          Get the property's value as a Double.
 java.lang.Float toFloat()
          Get the property's value as a Float.
 java.lang.Integer toInteger()
          Get the property's value as an Integer.
 java.lang.Long toLong()
          Get the property's value as a Long.
 java.lang.Number toNumber()
          Get the property's value as a Number.
 java.lang.Object toObject()
          Get the property's value as an object.
 
Methods inherited from class org.joda.property.impl.AbstractProperty
addPropertyChangeListener, bean, checkArgumentNotNull, checkModifiable, checkValueNotNull, checkValueNotNull, cloneDeep, convertObject, createClonedProperty, data, equals, equalsValue, firePropertyChange, firePropertyChange, getContentName, getContentType, getPropertyName, getThis, hashCode, initBeanCreated, initPropertyCreated, isModifiable, isNull, isReadOnly, populateClonedProperty, removePropertyChangeListener, set, setModifiable, setReadOnly, toDataString, toString
 
Methods inherited from class org.joda.property.impl.AbstractModelElement
getAttribute, getAttributeCount, getAttributeMap, setAttribute
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.joda.property.type.NumericProperty
add, add, add, divideBy, divideBy, divideBy, multiplyBy, multiplyBy, multiplyBy, negate, set, set, subtract, subtract, subtract, toBigDecimal
 
Methods inherited from interface org.joda.property.type.DataProperty
toDataString
 
Methods inherited from interface org.joda.property.Property
addPropertyChangeListener, bean, equals, equalsValue, firePropertyChange, getContentName, getContentType, getPropertyName, getPropertyType, hashCode, isModifiable, isNull, isReadOnly, removePropertyChangeListener, set, setModifiable, setReadOnly, toString
 
Methods inherited from interface org.joda.property.ModelElement
getAttribute, getAttributeCount, getAttributeMap, setAttribute
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

AbstractNumericProperty

public AbstractNumericProperty()
Constructor

Method Detail

getInternal

protected java.lang.Number getInternal()
Get the value from the data store


setInternal

protected void setInternal(java.lang.Number newValue)
Set the value to the data store


toObject

public java.lang.Object toObject()
Description copied from interface: Property
Get the property's value as an object. The object type will be appropriate for the type of property. The object will either be immutable or a clone of the real object.

This method has strong semantics such that where a and b are properties of the same type, it must be true that:
b.set( a.toObject() ); a.equals(b);
In other words, the object contains all the data necessary to recreate the property's value.

Specified by:
toObject in interface Property
Specified by:
toObject in class AbstractProperty
Returns:
an Object representing the property's value
See Also:
Property#toObject()

toNumber

public java.lang.Number toNumber()
Description copied from interface: NumericProperty
Get the property's value as a Number.

Specified by:
toNumber in interface NumericProperty
Returns:
the property value as a Number
See Also:
NumericProperty.toNumber()

equals

public boolean equals(long anotherValue)
Description copied from interface: NumericProperty
Is the property's value equal to the passed in value.

Specified by:
equals in interface NumericProperty
Parameters:
anotherValue - a value to compare the property to
Returns:
true if property value is equal
See Also:
NumericProperty.equals(long)

equals

public boolean equals(double anotherValue)
Description copied from interface: NumericProperty
Is the property's value equal to the passed in value.

Specified by:
equals in interface NumericProperty
Parameters:
anotherValue - a value to compare the property to
Returns:
true if property value is equal
See Also:
NumericProperty.equals(double)

compareTo

public int compareTo(long anotherValue)
Description copied from interface: NumericProperty
Compare the property's value to the passed in value.

Specified by:
compareTo in interface NumericProperty
Parameters:
anotherValue - a value to compare the property to
Returns:
zero if equal, -ve if property is less, +ve if property is greater
See Also:
NumericProperty.compareTo(long)

compareTo

public int compareTo(double anotherValue)
Description copied from interface: NumericProperty
Compare the property's value to the passed in value.

Specified by:
compareTo in interface NumericProperty
Parameters:
anotherValue - a value to compare the property to
Returns:
zero if equal, -ve if property is less, +ve if property is greater
See Also:
NumericProperty.compareTo(double)

isLessThan

public boolean isLessThan(long anotherValue)
Description copied from interface: NumericProperty
Is the property's value less than the passed in value.

Specified by:
isLessThan in interface NumericProperty
Parameters:
anotherValue - a value to compare the property to
Returns:
true if property is less
See Also:
NumericProperty.isLessThan(long)

isLessThan

public boolean isLessThan(double anotherValue)
Description copied from interface: NumericProperty
Is the property's value less than the passed in value.

Specified by:
isLessThan in interface NumericProperty
Parameters:
anotherValue - a value to compare the property to
Returns:
true if property is less
See Also:
NumericProperty.isLessThan(double)

isLessThan

public boolean isLessThan(java.lang.Object anotherValue)
Description copied from interface: NumericProperty
Is the property's value less than the passed in value.

Specified by:
isLessThan in interface NumericProperty
Parameters:
anotherValue - a value to compare the property to
Returns:
true if property is less
See Also:
NumericProperty.isLessThan(Object)

isGreaterThan

public boolean isGreaterThan(long anotherValue)
Description copied from interface: NumericProperty
Is the property's value greater than the passed in value.

Specified by:
isGreaterThan in interface NumericProperty
Parameters:
anotherValue - a value to compare the property to
Returns:
true if property is greater
See Also:
NumericProperty.isGreaterThan(long)

isGreaterThan

public boolean isGreaterThan(double anotherValue)
Description copied from interface: NumericProperty
Is the property's value greater than the passed in value.

Specified by:
isGreaterThan in interface NumericProperty
Parameters:
anotherValue - a value to compare the property to
Returns:
true if property is greater
See Also:
NumericProperty.isGreaterThan(double)

isGreaterThan

public boolean isGreaterThan(java.lang.Object anotherValue)
Description copied from interface: NumericProperty
Is the property's value greater than the passed in value.

Specified by:
isGreaterThan in interface NumericProperty
Parameters:
anotherValue - a value to compare the property to
Returns:
true if property is greater
See Also:
NumericProperty.isGreaterThan(Object)

intValue

public int intValue()
Description copied from interface: NumericProperty
Get the property's value as an int.

Specified by:
intValue in interface NumericProperty
Returns:
the property value as an int
See Also:
NumericProperty.intValue()

longValue

public long longValue()
Description copied from interface: NumericProperty
Get the property's value as a long.

Specified by:
longValue in interface NumericProperty
Returns:
the property value as a long
See Also:
NumericProperty.longValue()

floatValue

public float floatValue()
Description copied from interface: NumericProperty
Get the property's value as a float.

Specified by:
floatValue in interface NumericProperty
Returns:
the property value as a float
See Also:
NumericProperty.floatValue()

doubleValue

public double doubleValue()
Description copied from interface: NumericProperty
Get the property's value as a double.

Specified by:
doubleValue in interface NumericProperty
Returns:
the property value as a double
See Also:
NumericProperty.doubleValue()

toInteger

public java.lang.Integer toInteger()
Description copied from interface: NumericProperty
Get the property's value as an Integer.

Specified by:
toInteger in interface NumericProperty
Returns:
the property value as an Integer
See Also:
NumericProperty.toInteger()

toLong

public java.lang.Long toLong()
Description copied from interface: NumericProperty
Get the property's value as a Long.

Specified by:
toLong in interface NumericProperty
Returns:
the property value as a Long
See Also:
NumericProperty.toLong()

toFloat

public java.lang.Float toFloat()
Description copied from interface: NumericProperty
Get the property's value as a Float.

Specified by:
toFloat in interface NumericProperty
Returns:
the property value as a Float
See Also:
NumericProperty.toFloat()

toDouble

public java.lang.Double toDouble()
Description copied from interface: NumericProperty
Get the property's value as a Double.

Specified by:
toDouble in interface NumericProperty
Returns:
the property value as a Double
See Also:
NumericProperty.toDouble()

Joda System API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.