Joda System API

org.joda.property.impl.type
Class AbstractLongProperty

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

public abstract class AbstractLongProperty
extends AbstractNumericProperty

Abstract implementation of a Long property.

Data is stored in the associated PropertyData object as a Long object. This is immutable so can be directly returned.

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
AbstractLongProperty()
          Constructor
 
Method Summary
 void add(double amount)
          Add to the property's value
 void add(long amount)
          Add to the property's value
 void add(java.lang.Object amount)
          Add to the property's value
 int compareTo(java.lang.Object object)
           
protected  java.lang.Long convertObjectToLong(java.lang.Object object)
          Convert an Object to a typecast Long, throwing an exception if unable to convert.
 void divideBy(double amount)
          Divide the property's value by the specified argument
 void divideBy(long amount)
          Divide the property's value by the specified argument
 void divideBy(java.lang.Object amount)
          Divide the property's value by the specified argument
 void multiplyBy(double amount)
          Multiply the property's value by the specified argument
 void multiplyBy(long amount)
          Multiply the property's value by the specified argument
 void multiplyBy(java.lang.Object amount)
          Multiply the property's value by the specified argument
 void negate()
          Negate the current value of the property.
 void set(double propertyValue)
          Set the property's value.
 void set(long propertyValue)
          Set the property's value.
 void set(java.lang.Object propertyValue)
          Set the property's value as an object.
 void subtract(double amount)
          Subtract from the property's value
 void subtract(long amount)
          Subtract from the property's value
 void subtract(java.lang.Object amount)
          Subtract from the property's value
 java.math.BigDecimal toBigDecimal()
          Get the property's value as a BigDecimal.
 java.lang.Long toLong()
          Get the property's value as a Long.
 
Methods inherited from class org.joda.property.impl.type.AbstractNumericProperty
compareTo, compareTo, doubleValue, equals, equals, floatValue, getInternal, intValue, isGreaterThan, isGreaterThan, isGreaterThan, isLessThan, isLessThan, isLessThan, longValue, setInternal, toDouble, toFloat, toInteger, toNumber, toObject
 
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, 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.DataProperty
toDataString
 
Methods inherited from interface org.joda.property.Property
addPropertyChangeListener, bean, equals, equalsValue, firePropertyChange, getContentName, getContentType, getPropertyName, getPropertyType, hashCode, isModifiable, isNull, isReadOnly, removePropertyChangeListener, setModifiable, setReadOnly, toString
 
Methods inherited from interface org.joda.property.ModelElement
getAttribute, getAttributeCount, getAttributeMap, setAttribute
 

Constructor Detail

AbstractLongProperty

public AbstractLongProperty()
Constructor

Method Detail

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
Overrides:
toLong in class AbstractNumericProperty
See Also:
NumericProperty#toLong()

toBigDecimal

public java.math.BigDecimal toBigDecimal()
Description copied from interface: NumericProperty
Get the property's value as a BigDecimal.

Returns:
the property value as a BigDecimal
See Also:
NumericProperty#toBigDecimal()

compareTo

public int compareTo(java.lang.Object object)
See Also:
Comparable.compareTo(Object)

convertObjectToLong

protected java.lang.Long convertObjectToLong(java.lang.Object object)
Convert an Object to a typecast Long, throwing an exception if unable to convert.

Parameters:
object -
Returns:
Long derived from the object

set

public void set(java.lang.Object propertyValue)
Description copied from interface: Property
Set the property's value as an object. The object type should be appropriate for the type of property. If necessary, the object will be cloned before it is stored internally. Implementations will recognise as many types of object passed in as possible. Null should always be accepted, primitive types will be reset back to zero/false.

If a String is passed in, it can be parsed in various ways. If the results of toDataString() are passed in, it must reconstitute the original value.

Specified by:
set in interface Property
Specified by:
set in class AbstractProperty
Parameters:
propertyValue - an Object to set the property's value to
See Also:
Property#set(Object)

set

public void set(long propertyValue)
Description copied from interface: NumericProperty
Set the property's value.

Parameters:
propertyValue - a value to set the property's value to
See Also:
NumericProperty#set(long)

set

public void set(double propertyValue)
Description copied from interface: NumericProperty
Set the property's value.

Parameters:
propertyValue - a value to set the property's value to
See Also:
NumericProperty#set(double)

add

public void add(long amount)
Description copied from interface: NumericProperty
Add to the property's value

Parameters:
amount - an amount to add to the property's value
See Also:
NumericProperty#add(long)

add

public void add(double amount)
Description copied from interface: NumericProperty
Add to the property's value

Parameters:
amount - an amount to add to the property's value
See Also:
NumericProperty#add(double)

add

public void add(java.lang.Object amount)
Description copied from interface: NumericProperty
Add to the property's value

Parameters:
amount - an amount to add to the property's value
See Also:
NumericProperty#add(Object)

subtract

public void subtract(long amount)
Description copied from interface: NumericProperty
Subtract from the property's value

Parameters:
amount - an amount to subtract from the property's value
See Also:
NumericProperty#subtract(long)

subtract

public void subtract(double amount)
Description copied from interface: NumericProperty
Subtract from the property's value

Parameters:
amount - an amount to subtract from the property's value
See Also:
NumericProperty#subtract(double)

subtract

public void subtract(java.lang.Object amount)
Description copied from interface: NumericProperty
Subtract from the property's value

Parameters:
amount - an amount to subtract from the property's value
See Also:
NumericProperty#subtract(Object)

multiplyBy

public void multiplyBy(long amount)
Description copied from interface: NumericProperty
Multiply the property's value by the specified argument

Parameters:
amount - an amount to multiply the property's value by
See Also:
NumericProperty#multiplyBy(long)

multiplyBy

public void multiplyBy(double amount)
Description copied from interface: NumericProperty
Multiply the property's value by the specified argument

Parameters:
amount - an amount to multiply the property's value by
See Also:
NumericProperty#multiplyBy(double)

multiplyBy

public void multiplyBy(java.lang.Object amount)
Description copied from interface: NumericProperty
Multiply the property's value by the specified argument

Parameters:
amount - an amount to multiply the property's value by
See Also:
NumericProperty#multiplyBy(Object)

divideBy

public void divideBy(long amount)
Description copied from interface: NumericProperty
Divide the property's value by the specified argument

Parameters:
amount - an amount to divide the property's value by
See Also:
NumericProperty#divideBy(long)

divideBy

public void divideBy(double amount)
Description copied from interface: NumericProperty
Divide the property's value by the specified argument

Parameters:
amount - an amount to divide the property's value by
See Also:
NumericProperty#divideBy(double)

divideBy

public void divideBy(java.lang.Object amount)
Description copied from interface: NumericProperty
Divide the property's value by the specified argument

Parameters:
amount - an amount to divide the property's value by
See Also:
NumericProperty#divideBy(Object)

negate

public void negate()
Description copied from interface: NumericProperty
Negate the current value of the property.

See Also:
NumericProperty#negate()

Joda System API

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