FileDocCategorySizeDatePackage
Money.javaAPI DocExample1510Thu Nov 08 00:23:38 GMT 2001com.ora.rmibook.chapter22.valueobjects

Money

public class Money extends ValueObject

Fields Summary
protected int
_cents
Constructors Summary
public Money(Integer cents)

        this (cents.intValue());
    
public Money(int cents)

        super (cents + " cents.");
        _cents = cents;
    
Methods Summary
public voidadd(com.ora.rmibook.chapter22.valueobjects.Money otherMoney)

        _cents += otherMoney.getCents();
    
public booleanequals(java.lang.Object object)

        if (object instanceof Money) {
            Money otherMoney = (Money) object;

            return (_cents == otherMoney.getCents());
        }
        return false;
    
public intgetCents()

        return _cents;
    
public booleangreaterThan(com.ora.rmibook.chapter22.valueobjects.Money otherMoney)

        if (_cents > otherMoney.getCents()) {
            return true;
        }
        return false;
    
public booleanisNegative()

        return _cents < 0;
    
private voidreadObject(java.io.ObjectInputStream in)

        System.out.println("in readObject");
        (Thread.currentThread()).dumpStack();
        in.defaultReadObject();
    
public voidsubtract(com.ora.rmibook.chapter22.valueobjects.Money otherMoney)

        _cents -= otherMoney.getCents();
    
private voidwriteObject(java.io.ObjectOutputStream out)

        System.out.println("in writeObject");
        (Thread.currentThread()).dumpStack();
        out.defaultWriteObject();