Package com.exedio.cope.pattern
Class Money<C extends Money.Currency>
- java.lang.Object
-
- com.exedio.cope.pattern.Money<C>
-
- All Implemented Interfaces:
Serializable
,Comparable<Money<C>>
public final class Money<C extends Money.Currency> extends Object implements Serializable, Comparable<Money<C>>
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Money.Currency
Empty interface.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Money<C>
add(Money<C> other)
long
amountStore(C currency)
static <CURRENCY extends Money.Currency>
Money<CURRENCY>[]array(int size)
BigDecimal
bigAmount(C currency)
BigDecimal
bigValue(C currency)
Deprecated.UsebigAmount(Currency)
insteadint
compareTo(Money<C> other)
Money<C>
divide(double other)
double
doubleAmount(Money.Currency currency)
double
doubleValue(Money.Currency currency)
Deprecated.UsedoubleAmount(Currency)
insteadboolean
equals(Object other)
boolean
equalsZero()
Price
getAmount()
Deprecated.Price
getAmount(Money.Currency currency)
C
getCurrency()
Money<C>
getGreater(Money<C> other)
Deprecated.Usemax(Money)
insteadMoney<C>
getLower(Money<C> other)
Deprecated.Usemin(Money)
insteadboolean
greaterThan(Money<C> other)
boolean
greaterThanOrEqual(Money<C> other)
boolean
greaterThanOrEqualZero()
boolean
greaterThanZero()
Money<C>
grossToNetPercent(int rate)
Money<C>
grossToTaxPercent(double rate)
Money<C>
grossToTaxPercent(int rate)
int
hashCode()
boolean
lessThan(Money<C> other)
boolean
lessThanOrEqual(Money<C> other)
boolean
lessThanOrEqualZero()
boolean
lessThanZero()
Money<C>
max(Money<C> other)
Money<C>
min(Money<C> other)
Money<C>
multiply(double other)
Money<C>
multiply(int other)
Money<C>
negate()
Money<C>
negative()
Deprecated.Usenegate()
insteadstatic <C extends Money.Currency>
Money<C>nullToZero(Money<C> value, C currency)
static <C extends Money.Currency>
Money<C>[]splitProportionately(Money<C> total, Money<C>[] weights)
long
store(C currency)
Deprecated.UseamountStore(Currency)
insteadstatic <C extends Money.Currency>
Money<C>storeOf(long amountStore, C currency)
static <C extends Money.Currency>
Money<C>storeOf(Integer amountStore, C currency)
static <C extends Money.Currency>
Money<C>storeOf(Long amountStore, C currency)
Money<C>
subtract(Money<C> other)
String
toString()
String
toStringShort()
static <C extends Money.Currency>
Money<C>valueOf(double amount, C currency)
static <C extends Money.Currency>
Money<C>valueOf(Price amount, C currency)
static <C extends Money.Currency>
Money<C>valueOf(BigDecimal value, C currency)
static <C extends Money.Currency>
Money<C>zero(C currency)
-
-
-
Method Detail
-
storeOf
public static <C extends Money.Currency> Money<C> storeOf(long amountStore, C currency)
-
storeOf
public static <C extends Money.Currency> Money<C> storeOf(Long amountStore, C currency)
-
storeOf
public static <C extends Money.Currency> Money<C> storeOf(Integer amountStore, C currency)
-
amountStore
public long amountStore(C currency)
-
getCurrency
public C getCurrency()
-
toStringShort
public String toStringShort()
-
zero
public static <C extends Money.Currency> Money<C> zero(C currency)
-
nullToZero
public static <C extends Money.Currency> Money<C> nullToZero(Money<C> value, C currency)
-
compareTo
public int compareTo(Money<C> other)
- Specified by:
compareTo
in interfaceComparable<C extends Money.Currency>
-
equalsZero
public boolean equalsZero()
-
lessThanZero
public boolean lessThanZero()
-
greaterThanZero
public boolean greaterThanZero()
-
lessThanOrEqualZero
public boolean lessThanOrEqualZero()
-
greaterThanOrEqualZero
public boolean greaterThanOrEqualZero()
-
splitProportionately
public static <C extends Money.Currency> Money<C>[] splitProportionately(Money<C> total, Money<C>[] weights)
-
array
public static <CURRENCY extends Money.Currency> Money<CURRENCY>[] array(int size)
-
valueOf
public static <C extends Money.Currency> Money<C> valueOf(double amount, C currency)
-
doubleAmount
public double doubleAmount(Money.Currency currency)
-
valueOf
public static <C extends Money.Currency> Money<C> valueOf(BigDecimal value, C currency)
-
bigAmount
public BigDecimal bigAmount(C currency)
-
valueOf
public static <C extends Money.Currency> Money<C> valueOf(Price amount, C currency)
-
getAmount
public Price getAmount(Money.Currency currency)
-
getAmount
@Deprecated public Price getAmount()
Deprecated.BEWARE: UsegetAmount(Currency)
instead
-
store
@Deprecated public long store(C currency)
Deprecated.UseamountStore(Currency)
instead
-
doubleValue
@Deprecated public double doubleValue(Money.Currency currency)
Deprecated.UsedoubleAmount(Currency)
instead
-
bigValue
@Deprecated public BigDecimal bigValue(C currency)
Deprecated.UsebigAmount(Currency)
instead
-
getLower
@Deprecated public Money<C> getLower(Money<C> other)
Deprecated.Usemin(Money)
instead
-
getGreater
@Deprecated public Money<C> getGreater(Money<C> other)
Deprecated.Usemax(Money)
instead
-
negative
@Deprecated public Money<C> negative()
Deprecated.Usenegate()
instead
-
-