Money
Keywords: junit.samples.money.Money class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## junit.samples.money
Class Money

    java.lang.Object
      junit.samples.money.Money

All Implemented Interfaces:
  IMoney

    public class Money

extends java.lang.Object
implements IMoney

A simple Money.

Constructor Summary
`Money(int amount, java.lang.String currency)` Constructs a money from the given amount and currency.

Method Summary
`IMoney` | `add(IMoney m)` Adds a money to this money.
`IMoney` | `addMoney(Money m)` Adds a simple Money to this money.
`IMoney` | `addMoneyBag(junit.samples.money.MoneyBag s)` Adds a MoneyBag to this money.
`int` | `amount()`
`void` | `appendTo(junit.samples.money.MoneyBag m)` Append this to a MoneyBag m.
`java.lang.String` | `currency()`
`boolean` | `equals(java.lang.Object anObject)`
`int` | `hashCode()`
`boolean` | `isZero()` Tests whether this money is zero
`IMoney` | `multiply(int factor)` Multiplies a money by the given factor.
`IMoney` | `negate()` Negates this money.
`IMoney` | `subtract(IMoney m)` Subtracts a money from this money.
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Money

    public Money(int amount,
                 java.lang.String currency)

  Constructs a money from the given amount and currency.

Method Detail

### add

    public IMoney add(IMoney m)

  Adds a money to this money. Forwards the request to the addMoney helper.

  Specified by:
    `add` in interface `IMoney`

### addMoney

    public IMoney addMoney(Money m)

  Description copied from interface: `IMoney`
  Adds a simple Money to this money. This is a helper method for implementing double dispatch

  Specified by:
    `addMoney` in interface `IMoney`

### addMoneyBag

    public IMoney addMoneyBag(junit.samples.money.MoneyBag s)

  Description copied from interface: `IMoney`
  Adds a MoneyBag to this money. This is a helper method for implementing double dispatch

  Specified by:
    `addMoneyBag` in interface `IMoney`

### amount

    public int amount()

### currency

    public java.lang.String currency()

### equals

    public boolean equals(java.lang.Object anObject)

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### isZero

    public boolean isZero()

  Description copied from interface: `IMoney`
  Tests whether this money is zero

  Specified by:
    `isZero` in interface `IMoney`

### multiply

    public IMoney multiply(int factor)

  Description copied from interface: `IMoney`
  Multiplies a money by the given factor.

  Specified by:
    `multiply` in interface `IMoney`

### negate

    public IMoney negate()

  Description copied from interface: `IMoney`
  Negates this money.

  Specified by:
    `negate` in interface `IMoney`

### subtract

    public IMoney subtract(IMoney m)

  Description copied from interface: `IMoney`
  Subtracts a money from this money.

  Specified by:
    `subtract` in interface `IMoney`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### appendTo

    public void appendTo(junit.samples.money.MoneyBag m)

  Description copied from interface: `IMoney`
  Append this to a MoneyBag m.

  Specified by:
    `appendTo` in interface `IMoney`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD