java.lang.Object
io.github.tonywasher.joceanus.oceanus.format.OceanusDataFormatter

public class OceanusDataFormatter extends Object
Data Formatter.
  • Constructor Details

    • OceanusDataFormatter

      public OceanusDataFormatter()
      Constructor.
    • OceanusDataFormatter

      public OceanusDataFormatter(Locale pLocale)
      Constructor.
      Parameters:
      pLocale - the locale
  • Method Details

    • getDateFormatter

      public OceanusDateFormatter getDateFormatter()
      Obtain the date formatter.
      Returns:
      the formatter
    • getDecimalFormatter

      public OceanusDecimalFormatter getDecimalFormatter()
      Obtain the decimal formatter.
      Returns:
      the formatter
    • getDecimalParser

      public OceanusDecimalParser getDecimalParser()
      Obtain the decimal parser.
      Returns:
      the parser
    • extendFormatter

      public void extendFormatter(OceanusDataFormatter.OceanusDataFormatterExtension pExtension)
      Extend the formatter.
      Parameters:
      pExtension - the extension
    • setAccountingWidth

      public void setAccountingWidth(int pWidth)
      Set accounting width.
      Parameters:
      pWidth - the accounting width to use
    • clearAccounting

      public void clearAccounting()
      Clear accounting mode.
    • setFormat

      public final void setFormat(String pFormat)
      Set the date format.
      Parameters:
      pFormat - the format string
    • setLocale

      public final void setLocale(Locale pLocale)
      Set the locale.
      Parameters:
      pLocale - the locale
    • getLocale

      public Locale getLocale()
      Obtain the locale.
      Returns:
      the locale
    • formatObject

      public String formatObject(Object pValue)
      Format an object value.
      Parameters:
      pValue - the object to format
      Returns:
      the formatted value
    • parseValue

      public <T> T parseValue(String pSource, Class<T> pClazz)
      Parse object value.
      Type Parameters:
      T - the value type
      Parameters:
      pSource - the source value
      pClazz - the value type class
      Returns:
      the formatted value
      Throws:
      IllegalArgumentException - on bad Date/Decimal format
      NumberFormatException - on bad Integer format
    • parseValue

      public <T> T parseValue(Double pSource, Class<T> pClazz)
      Parse object value.
      Type Parameters:
      T - the value type
      Parameters:
      pSource - the source value
      pClazz - the value type class
      Returns:
      the formatted value
      Throws:
      IllegalArgumentException - on bad TethysDecimal format
    • parseValue

      public <T> T parseValue(Double pSource, String pCurrCode, Class<T> pClazz)
      Parse object value.
      Type Parameters:
      T - the value type
      Parameters:
      pSource - the source value
      pCurrCode - the currency code
      pClazz - the value type class
      Returns:
      the formatted value
      Throws:
      IllegalArgumentException - on bad TethysDecimal format