Package de.hybris.platform.util
Class PriceValue
- java.lang.Object
-
- de.hybris.platform.util.PriceValue
-
- All Implemented Interfaces:
PDTValue
,java.io.Serializable
public class PriceValue extends java.lang.Object implements java.io.Serializable, PDTValue
default price value object. this object tells whether a price is net or gross and which currency (iso code) this price belongs to.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PriceValue(java.lang.String currencyIso, double price, boolean netto)
Creates a new price value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object object)
java.lang.String
getCurrencyIso()
The currency iso code of this price.PriceValue
getOtherPrice(double relativeTotalTaxes)
converts this price into another price with opposing net/gross state.PriceValue
getOtherPrice(double relativeTotalTaxes, double absoluteTotalTaxes)
converts this price into another price with opposing net/gross state.PriceValue
getOtherPrice(java.util.Collection taxValues)
converts this price into another price with opposing net/gross state.double
getValue()
The numeric value of this price.int
hashCode()
boolean
isNet()
Tells if this value includes taxes or not.static PriceValue
parsePriceValue(java.lang.String str)
static java.util.Collection
parsePriceValueCollection(java.lang.String str)
java.lang.String
toString()
static java.lang.String
toString(java.util.Collection prices)
-
-
-
Constructor Detail
-
PriceValue
public PriceValue(java.lang.String currencyIso, double price, boolean netto)
Creates a new price value.- Parameters:
price
- the value of this pricenetto
- determines if the value includes taxes or not ( true = netto = no taxes )currencyIso
- the currency iso code for this price
-
-
Method Detail
-
getOtherPrice
public PriceValue getOtherPrice(double relativeTotalTaxes)
converts this price into another price with opposing net/gross state. this requires to specify all taxes which apply to this price (without taxes net == gross ;) the price is not rounded here!- Parameters:
relativeTotalTaxes
- the sum of all relative taxes e.g. 16% + 7% = 23%- Returns:
- a new price value instance holding the converted price
-
getOtherPrice
public PriceValue getOtherPrice(double relativeTotalTaxes, double absoluteTotalTaxes)
converts this price into another price with opposing net/gross state. this requires to specify all taxes which apply to this price (without taxes net == gross ;) the price is not rounded here!- Parameters:
relativeTotalTaxes
- the sum of all relative taxes e.g. 16% + 7% = 23%absoluteTotalTaxes
- the sum of all absolute taxes - no currency conversion here !!!- Returns:
- a new price value instance holding the converted price
-
getOtherPrice
public PriceValue getOtherPrice(java.util.Collection taxValues)
converts this price into another price with opposing net/gross state. this requires to specify all taxes which apply to this price (without taxes net == gross ;) the price is not rounded here!- Parameters:
taxValues
- a collection of tax values which apply to this price- Returns:
- a new price value instance holding the converted price
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toString
public static final java.lang.String toString(java.util.Collection prices)
-
parsePriceValueCollection
public static java.util.Collection parsePriceValueCollection(java.lang.String str) throws java.lang.IllegalArgumentException
- Throws:
java.lang.IllegalArgumentException
-
parsePriceValue
public static PriceValue parsePriceValue(java.lang.String str) throws java.lang.IllegalArgumentException
- Throws:
java.lang.IllegalArgumentException
-
getValue
public double getValue()
The numeric value of this price.
-
isNet
public boolean isNet()
Tells if this value includes taxes or not. Which taxes apply to this price (whether they are included or not) is specified by @link #getTaxPKs().- Returns:
- true if no taxes are included in the value
-
getCurrencyIso
public java.lang.String getCurrencyIso()
The currency iso code of this price.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equals
in classjava.lang.Object
-
-