All Implemented Interfaces:
Comparable<OceanusDecimal>

public class OceanusPrice extends OceanusMoney
Represents a Price object.
  • Field Details

    • XTRA_DECIMALS

      static final int XTRA_DECIMALS
      Additional number of decimals for Price.
      See Also:
  • Constructor Details

    • OceanusPrice

      public OceanusPrice()
      Constructor for price of value zero in the default currency.
    • OceanusPrice

      public OceanusPrice(Currency pCurrency)
      Constructor for money of value zero in specified currency.
      Parameters:
      pCurrency - the currency
    • OceanusPrice

      public OceanusPrice(OceanusPrice pPrice)
      Construct a new Price by copying another price.
      Parameters:
      pPrice - the Price to copy
    • OceanusPrice

      public OceanusPrice(String pSource)
      Constructor for price from a decimal string.
      Parameters:
      pSource - The source decimal string
      Throws:
      IllegalArgumentException - on invalidly formatted argument
    • OceanusPrice

      public OceanusPrice(String pSource, Currency pCurrency)
      Constructor for price from a decimal string.
      Parameters:
      pSource - The source decimal string
      pCurrency - the currency
      Throws:
      IllegalArgumentException - on invalidly formatted argument
    • OceanusPrice

      public OceanusPrice(byte[] pBuffer)
      Create the price from a byte array.
      Parameters:
      pBuffer - the buffer
  • Method Details

    • getWholeUnits

      public static OceanusPrice getWholeUnits(long pUnits, Currency pCurrency)
      Factory method for generating whole monetary units for a currency (e.g. £)
      Parameters:
      pUnits - the number of whole monetary units
      pCurrency - the currency
      Returns:
      the allocated price
    • getWholeUnits

      public static OceanusPrice getWholeUnits(long pUnits)
      Factory method for generating whole monetary units (e.g. £)
      Parameters:
      pUnits - the number of whole monetary units
      Returns:
      the allocated price
    • changeCurrency

      public OceanusPrice changeCurrency(Currency pCurrency)
      Description copied from class: OceanusMoney
      Obtain value in different currency.
      Overrides:
      changeCurrency in class OceanusMoney
      Parameters:
      pCurrency - the currency to convert to
      Returns:
      the converted money in the new currency
    • convertCurrency

      public OceanusPrice convertCurrency(Currency pCurrency, OceanusRatio pRate)
      Description copied from class: OceanusMoney
      Obtain converted money.
      Overrides:
      convertCurrency in class OceanusMoney
      Parameters:
      pCurrency - the currency to convert to
      pRate - the conversion rate
      Returns:
      the converted money in the new currency
    • subtractPrice

      public void subtractPrice(OceanusPrice pValue)
      Subtract a monetary price from the value.
      Parameters:
      pValue - The money to subtract from this one.