org.beanfabrics.model
Class BigDecimalPM.Format

java.lang.Object
  extended by org.beanfabrics.model.BigDecimalPM.Format
All Implemented Interfaces:
IFormat<java.math.BigDecimal>
Enclosing class:
BigDecimalPM

public static class BigDecimalPM.Format
extends java.lang.Object
implements IFormat<java.math.BigDecimal>

The BigDecimalPM.Format is a IFormat for converting between BigDecimal and String.


Constructor Summary
BigDecimalPM.Format(java.text.DecimalFormat format)
          Creates a BigDecimalPM.Format using the given DecimalFormat.
BigDecimalPM.Format(java.text.DecimalFormat aStrictFormat, java.text.DecimalFormat aSimplifiedFormat)
          Creates a BigDecimalPM.Format using the given two formats.
 
Method Summary
 java.text.DecimalFormat createSimplifiedNumberFormat(java.text.DecimalFormat aFormat)
          Creates a simplified version of the given format.
 java.lang.String format(java.math.BigDecimal value)
          Formats the given value to a String representation.
 java.text.DecimalFormat getSimplifiedFormat()
           
 java.text.DecimalFormat getStrictFormat()
           
 java.math.BigDecimal parse(java.lang.String text)
          Parses the given text and returns an instance of T that is represented by the text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BigDecimalPM.Format

public BigDecimalPM.Format(java.text.DecimalFormat format)
Creates a BigDecimalPM.Format using the given DecimalFormat.

Parameters:
format -

BigDecimalPM.Format

public BigDecimalPM.Format(java.text.DecimalFormat aStrictFormat,
                           java.text.DecimalFormat aSimplifiedFormat)
Creates a BigDecimalPM.Format using the given two formats.

Parameters:
aStrictFormat - the strict format defines, how to format a BigDecimal into a String and how to parse it
aSimplifiedFormat - the simplified format defines, how to parse a String if the strict format fails to parse it
Method Detail

getStrictFormat

public java.text.DecimalFormat getStrictFormat()

getSimplifiedFormat

public java.text.DecimalFormat getSimplifiedFormat()

parse

public java.math.BigDecimal parse(java.lang.String text)
                           throws ConversionException
Parses the given text and returns an instance of T that is represented by the text.

Specified by:
parse in interface IFormat<java.math.BigDecimal>
Returns:
an instance of T that represents the given text
Throws:
ConversionException

format

public java.lang.String format(java.math.BigDecimal value)
Formats the given value to a String representation.

Specified by:
format in interface IFormat<java.math.BigDecimal>
Returns:
the String representation of the given value

createSimplifiedNumberFormat

public java.text.DecimalFormat createSimplifiedNumberFormat(java.text.DecimalFormat aFormat)
Creates a simplified version of the given format. A format is 'simplified' if it contains only those formatting symbols that have to do with the numeric representation. Any literals are removed.

Parameters:
aFormat -
Returns:
a simplified version of the given format