@Embeddable public class Amount extends DomainObject implements IAmount<Amount>
setSubAmounts(List)
is defined, then any operations on this like add(Amount)
, deduct(Amount)
will show up in the sub-amountsConstructor and Description |
---|
Amount() |
Amount(Double total)
Initialized version will initialize all numerals to 0D
|
Amount(Double total,
String currency) |
Amount(IAmount amt) |
Modifier and Type | Method and Description |
---|---|
Amount |
add(Amount amt)
Will add the amount to the current amount and return the updated current amount;
parameter null values are skipped
|
Amount |
clone() |
int |
compareTo(IAmount o) |
Amount |
deduct(Amount amt)
Will deduct the amount to the current amount and return the updated current amount;
parameter null values are skipped
|
boolean |
equals(Object obj) |
Double |
getBase()
In the default behavior/understanding, the base price reflect the regular total of the product
|
String |
getCurrency() |
Double |
getDiscount()
Should be a (-) quantity if discount is being offered.
|
Integer |
getPrecision()
When storing decimal numbers or fractions, recurring decimals
could be rounded or truncated at some point.
|
String |
getRegion() |
List<Amount> |
getSubAmounts()
A
Transient field, if NOT null, will also track any sub-calculations (AAmount) used in cumulative operations
while calculating this Amount. |
Double |
getTax() |
Boolean |
getTaxReverseCaculated()
In some cases the tax maybe already included in the product/item value.
|
Double |
getTotal() |
int |
hashCode() |
void |
setBase(Double base)
In the default behavior/understanding, the base price reflect the regular total of the product
|
void |
setCurrency(String currency) |
void |
setDiscount(Double discount)
Should be a (-) quantity if discount is being offered.
|
void |
setPrecision(Integer precision)
When storing decimal numbers or fractions, recurring decimals
could be rounded or truncated at some point.
|
void |
setRegion(String region) |
void |
setSubAmounts(List<Amount> subAmounts)
A
Transient field, if NOT null, will also track any sub-calculations (AAmount) used in cumulative operations
while calculating this Amount. |
void |
setTax(Double tax) |
void |
setTaxReverseCaculated(Boolean taxReverseCaculated)
In some cases the tax maybe already included in the product/item value.
|
void |
setTotal(Double total) |
String |
toString() |
public Amount()
public Amount(Double total)
total
- as Doublepublic Amount(IAmount amt)
public Double getBase()
public void setBase(Double base)
base
- as Doublepublic Double getDiscount()
deduct(Amount)
is called. Hence this should be negative.public void setDiscount(Double discount)
deduct(Amount)
is called. Hence this should be negative.public Double getTax()
public void setTax(Double tax)
public void setTotal(Double total)
public String getCurrency()
getCurrency
in interface IAmount<Amount>
public void setCurrency(String currency)
public String getRegion()
public void setRegion(String region)
public Integer getPrecision()
public void setPrecision(Integer precision)
public Boolean getTaxReverseCaculated()
public void setTaxReverseCaculated(Boolean taxReverseCaculated)
public Amount add(Amount amt)
public Amount deduct(Amount amt)
public List<Amount> getSubAmounts()
Transient
field, if NOT null, will also track any sub-calculations (AAmount) used in cumulative operations
while calculating this Amount.public void setSubAmounts(List<Amount> subAmounts)
Transient
field, if NOT null, will also track any sub-calculations (AAmount) used in cumulative operations
while calculating this Amount.public int compareTo(IAmount o)
compareTo
in interface Comparable<IAmount>
Copyright © 2018. All rights reserved.