Package de.hybris.platform.util
Class TaxValue
java.lang.Object
de.hybris.platform.util.TaxValue
- All Implemented Interfaces:
PDTValue,Serializable,Cloneable
- Direct Known Subclasses:
CachingFindTaxValueInfoStrategy.CachedTaxValue,Europe1PriceFactory.CachedTaxValue
the string-storeable tax value object.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreates a copy of this tax value holding the applied value for a given price rounded to given digits.static Collectionapply(double quantity, double price, int digits, Collection taxValues, boolean priceIsNet, String currencyIso) creates a collection of applied tax values for a given price and a tax value collection.clone()Returns an exact copy of theTaxValue(@see java.lang.Object#clone()).booleandoubleReturns the applied value of theTaxValue.getCode()Returns the code of theTaxValue.Returns the currency iso code of this absoluteTaxValueornullif the tax value is relative.doublegetValue()Returns the value of theTaxValue.inthashCode()booleanReturnstrueif thisTaxValueis absolute.static TaxValueparseTaxValue(String str) creates a tax value object from its string representation created via @see #toString().static Collectioncreates a tax value collection from its string representation created via @see #toString(Collection).static doublesumAbsoluteTaxValues(Collection taxValues) static doublesumAppliedTaxValues(Collection taxValues) static doublesumRelativeTaxValues(Collection taxValues) toString()Returns a string representation of this tax value.static StringtoString(Collection taxValueCollection) creates the string representation of a collection of tax values.unapply()
-
Constructor Details
-
TaxValue
constructs a new TaxValue object.- Parameters:
code-value-absolute-currencyIsoCode-
-
TaxValue
-
-
Method Details
-
getCode
Returns the code of theTaxValue.- Returns:
- the code of the
TaxValue.
-
getCurrencyIsoCode
Returns the currency iso code of this absoluteTaxValueornullif the tax value is relative. -
getValue
public double getValue()Returns the value of theTaxValue. -
getAppliedValue
public double getAppliedValue()Returns the applied value of theTaxValue.- Returns:
- the applied value of the
TaxValue.
-
isAbsolute
public boolean isAbsolute()Returnstrueif thisTaxValueis absolute.- Returns:
trueif theTaxValueis absolute.
-
clone
Returns an exact copy of theTaxValue(@see java.lang.Object#clone()). -
apply
public TaxValue apply(double quantity, double price, int digits, boolean priceIsNet, String currencyIsoCode) creates a copy of this tax value holding the applied value for a given price rounded to given digits.- Parameters:
price- the price to apply this tax value todigits- the digits to round the value to, if < 0 no rounding is donepriceIsNet-trueif the given price is net.- Returns:
- returns a copy of this
TaxValueholding the applied value for a given price rounded to given digits. - Since:
- 2.20
-
apply
public static Collection apply(double quantity, double price, int digits, Collection taxValues, boolean priceIsNet, String currencyIso) creates a collection of applied tax values for a given price and a tax value collection. all resulting applied values prices are rounded to the given number of digits.- Parameters:
price- the price to apply these taxes todigits- the number of digits to round, if < 0 no rounding is donetaxValues- the collection of taxes to apply to the pricepriceIsNet-trueif given price is net,falseif given price is gross- Returns:
- the collection of applied tax values for the given parameters.
- Since:
- 2.20
-
sumRelativeTaxValues
-
sumAbsoluteTaxValues
-
sumAppliedTaxValues
-
toString
Returns a string representation of this tax value. You may restore this object via @see #parseTaxValue(String). -
toString
creates the string representation of a collection of tax values. You may restore this collection via @see #parseTaxValueCollection(String).- Parameters:
taxValueCollection- a collection containing StandardTaxValues- Returns:
- string representation of a collection of tax values.
-
parseTaxValueCollection
creates a tax value collection from its string representation created via @see #toString(Collection).- Parameters:
str- string representation of aTaxValue.- Returns:
- a tax value collection from its string representation.
- Throws:
IllegalArgumentException- if a parse error occurred
-
parseTaxValue
creates a tax value object from its string representation created via @see #toString().- Parameters:
str- string representation of aTaxValue.- Returns:
- a tax value object from its string representation.
- Throws:
IllegalArgumentException- if the string is not valid
-
hashCode
public int hashCode() -
equals
-
unapply
- Returns:
- an exact copy of this tax value except its applied value.
-