Class PriceValue

java.lang.Object
de.hybris.platform.util.PriceValue
All Implemented Interfaces:
PDTValue, Serializable

public class PriceValue extends Object implements 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:
  • Constructor Details

    • PriceValue

      public PriceValue(String currencyIso, double price, boolean netto)
      Creates a new price value.
      Parameters:
      price - the value of this price
      netto - determines if the value includes taxes or not ( true = netto = no taxes )
      currencyIso - the currency iso code for this price
  • Method Details

    • 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(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 String toString()
      Overrides:
      toString in class Object
    • toString

      public static final String toString(Collection prices)
    • parsePriceValueCollection

      public static Collection parsePriceValueCollection(String str) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • parsePriceValue

      public static PriceValue parsePriceValue(String str) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • getValue

      public double getValue()
      The numeric value of this price.
      Specified by:
      getValue in interface PDTValue
      Returns:
      the value of the PDTValue object
    • 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 String getCurrencyIso()
      The currency iso code of this price.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object