org.nakedobjects.object.value
Class Currency

java.lang.Object
  extended byorg.nakedobjects.object.value.AbstractNakedValue
      extended byorg.nakedobjects.object.value.Currency
All Implemented Interfaces:
java.io.Externalizable, Naked, NakedValue, java.io.Serializable

public class Currency
extends AbstractNakedValue
implements java.io.Externalizable

Value object representing a monetary value including a currency type. Note this is currently limited to pounds sterling.

NOTE: this class does not (and is unlikely ever to) support about listeners. Use Money instead.

See Also:
Money, Serialized Form

Constructor Summary
Currency()
          Deprecated. Create a Currency with zero value.
Currency(Currency currency)
          Deprecated. Create a Currency with the same value as the specified object.
Currency(int whole, int part)
          Deprecated. Create a Currency with the specified values.
Currency(java.lang.String text)
          Deprecated. Create a Currency by parsing the text value.
 
Method Summary
 void add(Currency value)
          Deprecated. Add the specified Currency value to this value.
 void add(int whole, int part)
          Deprecated. Add the specified values to this value.
 int asInt()
          Deprecated. Add the this value as an int.
 void clear()
          Deprecated. Clears the value so that it is empty, i.e.
 void copyObject(Naked object)
          Deprecated. Copies the specified object's contained data to this instance.
 void divideBy(double operand)
          Deprecated. Divides this value by the specified amount.
 java.lang.String getObjectHelpText()
          Deprecated. Returns a textual desctiption of the object - its contents and possible uses.
 boolean isEmpty()
          Deprecated. Returns true if the object contains no data, eg when new
 boolean isGreaterThan(Currency value)
          Deprecated. Returns true if this value is greater than the specified values.
 boolean isLessThan(Currency value)
          Deprecated. Returns true if this value is less than the specified values.
 boolean isNegative()
          Deprecated. Returns true if this value is less than zero.
 boolean isSameAs(Naked object)
          Deprecated. Checks to see if two objects contain the same information.
 void multiplyBy(double operand)
          Deprecated. Multiply this value by the specified amount.
 void parse(java.lang.String in)
          Deprecated. Takes a user entry string which is parsed to set up the object.
 void readExternal(java.io.ObjectInput in)
          Deprecated.  
 void reset()
          Deprecated. Resets a value to its default value.
 void restoreString(java.lang.String data)
          Deprecated. Takes a storage string and uses it reinstate this value object to its previous state/
 java.lang.String saveString()
          Deprecated. Returns a basic string representation of this value for storage purposes.
 void setValue(Currency value)
          Deprecated. Set this value to be the same as the specified value.
 void setValue(int whole, int part)
          Deprecated. Set this value to have the specified values.
 void subtract(Currency value)
          Deprecated. Subtract the specified amount from this value.
 void subtract(int whole, int part)
          Deprecated. Subtract the specified amount from this value.
 Title title()
          Deprecated. Returns a Title object describing the object.
 void writeExternal(java.io.ObjectOutput out)
          Deprecated.  
 
Methods inherited from class org.nakedobjects.object.value.AbstractNakedValue
about, addNakedValueListener, checkCanOperate, contextualTitle, deepCopy, dumpObject, fireValueChanged, fireValueChanged, getClassName, getFullClassName, getLogger, isNull, isValid, nakedValueListeners, removeNakedValueListener, setAbout, setNull, setValidity, summary, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Currency

public Currency()
Deprecated. 
Create a Currency with zero value.


Currency

public Currency(int whole,
                int part)
Deprecated. 
Create a Currency with the specified values.


Currency

public Currency(java.lang.String text)
Deprecated. 
Create a Currency by parsing the text value.


Currency

public Currency(Currency currency)
Deprecated. 
Create a Currency with the same value as the specified object.

Method Detail

add

public void add(int whole,
                int part)
Deprecated. 
Add the specified values to this value.


add

public void add(Currency value)
Deprecated. 
Add the specified Currency value to this value.


asInt

public int asInt()
Deprecated. 
Add the this value as an int. The value return is calculated by multiplying the whole by 100 and adding the part.


clear

public void clear()
Deprecated. 
Description copied from interface: NakedValue
Clears the value so that it is empty, i.e. isEmpty returns true.

Specified by:
clear in interface NakedValue

copyObject

public void copyObject(Naked object)
Deprecated. 
Copies the specified object's contained data to this instance.

Specified by:
copyObject in interface Naked
Parameters:
object - the object to copy the data from

divideBy

public void divideBy(double operand)
Deprecated. 
Divides this value by the specified amount.


getObjectHelpText

public java.lang.String getObjectHelpText()
Deprecated. 
Description copied from interface: Naked
Returns a textual desctiption of the object - its contents and possible uses.

Specified by:
getObjectHelpText in interface Naked
Overrides:
getObjectHelpText in class AbstractNakedValue

isEmpty

public boolean isEmpty()
Deprecated. 
Description copied from interface: Naked
Returns true if the object contains no data, eg when new

Specified by:
isEmpty in interface Naked

isGreaterThan

public boolean isGreaterThan(Currency value)
Deprecated. 
Returns true if this value is greater than the specified values.


isLessThan

public boolean isLessThan(Currency value)
Deprecated. 
Returns true if this value is less than the specified values.


isNegative

public boolean isNegative()
Deprecated. 
Returns true if this value is less than zero.


multiplyBy

public void multiplyBy(double operand)
Deprecated. 
Multiply this value by the specified amount.


parse

public void parse(java.lang.String in)
           throws ValueParseException
Deprecated. 
Description copied from interface: NakedValue
Takes a user entry string which is parsed to set up the object. This needs to accomodate punctuation and adornments such as currency signs.

Specified by:
parse in interface NakedValue
Throws:
ValueParseException
See Also:
NakedValue.restoreString(String)

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Deprecated. 
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

reset

public void reset()
Deprecated. 
Description copied from interface: NakedValue
Resets a value to its default value. Contrast this with the clear method.

Specified by:
reset in interface NakedValue

setValue

public void setValue(int whole,
                     int part)
Deprecated. 
Set this value to have the specified values.


setValue

public void setValue(Currency value)
Deprecated. 
Set this value to be the same as the specified value.


subtract

public void subtract(int whole,
                     int part)
Deprecated. 
Subtract the specified amount from this value.


subtract

public void subtract(Currency value)
Deprecated. 
Subtract the specified amount from this value.


title

public Title title()
Deprecated. 
Description copied from interface: Naked
Returns a Title object describing the object.

Specified by:
title in interface Naked

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Deprecated. 
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

isSameAs

public boolean isSameAs(Naked object)
Deprecated. 
Description copied from interface: Naked
Checks to see if two objects contain the same information. Compare with equals, which determines if the one object is replaceable with another.

Specified by:
isSameAs in interface Naked
Parameters:
object - the object to compare
Returns:
boolean returns true if the objects have the same content, and false if the objects are of different types or their contents are deemed to be different.

restoreString

public void restoreString(java.lang.String data)
Deprecated. 
Description copied from interface: NakedValue
Takes a storage string and uses it reinstate this value object to its previous state/

Specified by:
restoreString in interface NakedValue
Parameters:
data -
See Also:
NakedValue.parse(String)

saveString

public java.lang.String saveString()
Deprecated. 
Description copied from interface: NakedValue
Returns a basic string representation of this value for storage purposes.

Specified by:
saveString in interface NakedValue