org.tbee.swing.text
Class NumberFormatCaster

java.lang.Object
  extended by java.text.Format
      extended by org.tbee.swing.text.NumberFormatCaster
All Implemented Interfaces:
Serializable, Cloneable

public class NumberFormatCaster
extends Format

Converts a value returned by NumberFormat to a certain class (e.g. Integer) This is convenient when using binding.

Author:
user
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.text.Format
Format.Field
 
Constructor Summary
NumberFormatCaster(NumberFormat numberFormat, Class type)
           
NumberFormatCaster(NumberFormat numberFormat, Class type, int minFractionDigits)
           
NumberFormatCaster(NumberFormat numberFormat, int minFractionDigits)
           
 
Method Summary
 StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
           
 int getMinFractionDigits()
           
 NumberFormat getNumberFormat()
           
 Class getType()
           
 Object parseObject(String source, ParsePosition pos)
           
 
Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberFormatCaster

public NumberFormatCaster(NumberFormat numberFormat,
                          Class type)
Parameters:
numberFormat -
type -

NumberFormatCaster

public NumberFormatCaster(NumberFormat numberFormat,
                          int minFractionDigits)
Parameters:
numberFormat -
type -
minFractionDigits - this makes only sense for BigDecimals where 0.0 is not equal to 0.000

NumberFormatCaster

public NumberFormatCaster(NumberFormat numberFormat,
                          Class type,
                          int minFractionDigits)
Parameters:
numberFormat -
type -
minFractionDigits - this makes only sense for BigDecimals where 0.0 is not equal to 0.000
Method Detail

getNumberFormat

public NumberFormat getNumberFormat()

getType

public Class getType()

getMinFractionDigits

public int getMinFractionDigits()

format

public StringBuffer format(Object obj,
                           StringBuffer toAppendTo,
                           FieldPosition pos)
Specified by:
format in class Format

parseObject

public Object parseObject(String source,
                          ParsePosition pos)
Specified by:
parseObject in class Format


Copyright © 2011 KnowledgePlaza. All Rights Reserved.