org.springframework.binding.format.support
Class StrictNumberFormat

java.lang.Object
  extended by java.text.Format
      extended by java.text.NumberFormat
          extended by org.springframework.binding.format.support.StrictNumberFormat
All Implemented Interfaces:
Serializable, Cloneable

public class StrictNumberFormat
extends NumberFormat

This is a decorator class for NumberFormat to ensure an exact number parsing. The NumberFormat class allows parsing of numbers in strings like '2abc' but at the richclient end we don't want this to be a valid parsing. Therefor a specific NumberFormat that doesn't allow any other input than a number.

Author:
Yudhi Widyatama, Jan Hoskens
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.text.NumberFormat
NumberFormat.Field
 
Field Summary
 
Fields inherited from class java.text.NumberFormat
FRACTION_FIELD, INTEGER_FIELD
 
Constructor Summary
StrictNumberFormat(NumberFormat instance)
           
 
Method Summary
 StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos)
           
 StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos)
           
 StringBuffer format(Object number, StringBuffer toAppendTo, FieldPosition pos)
           
 AttributedCharacterIterator formatToCharacterIterator(Object obj)
           
 Currency getCurrency()
           
 int getMaximumFractionDigits()
           
 int getMaximumIntegerDigits()
           
 int getMinimumFractionDigits()
           
 int getMinimumIntegerDigits()
           
 int hashCode()
           
 boolean isGroupingUsed()
           
 boolean isParseIntegerOnly()
           
 Number parse(String source)
           
 Number parse(String source, ParsePosition parsePosition)
           
 Object parseObject(String source)
           
 void setCurrency(Currency currency)
           
 void setGroupingUsed(boolean newValue)
           
 void setMaximumFractionDigits(int newValue)
           
 void setMaximumIntegerDigits(int newValue)
           
 void setMinimumFractionDigits(int newValue)
           
 void setMinimumIntegerDigits(int newValue)
           
 void setParseIntegerOnly(boolean value)
           
 
Methods inherited from class java.text.NumberFormat
clone, equals, format, format, getAvailableLocales, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, getRoundingMode, parseObject, setRoundingMode
 
Methods inherited from class java.text.Format
format
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StrictNumberFormat

public StrictNumberFormat(NumberFormat instance)
Method Detail

format

public StringBuffer format(double number,
                           StringBuffer toAppendTo,
                           FieldPosition pos)
Specified by:
format in class NumberFormat

format

public StringBuffer format(long number,
                           StringBuffer toAppendTo,
                           FieldPosition pos)
Specified by:
format in class NumberFormat

format

public StringBuffer format(Object number,
                           StringBuffer toAppendTo,
                           FieldPosition pos)
Overrides:
format in class NumberFormat

formatToCharacterIterator

public AttributedCharacterIterator formatToCharacterIterator(Object obj)
Overrides:
formatToCharacterIterator in class Format

getCurrency

public Currency getCurrency()
Overrides:
getCurrency in class NumberFormat

getMaximumFractionDigits

public int getMaximumFractionDigits()
Overrides:
getMaximumFractionDigits in class NumberFormat

getMaximumIntegerDigits

public int getMaximumIntegerDigits()
Overrides:
getMaximumIntegerDigits in class NumberFormat

getMinimumFractionDigits

public int getMinimumFractionDigits()
Overrides:
getMinimumFractionDigits in class NumberFormat

getMinimumIntegerDigits

public int getMinimumIntegerDigits()
Overrides:
getMinimumIntegerDigits in class NumberFormat

hashCode

public int hashCode()
Overrides:
hashCode in class NumberFormat

isGroupingUsed

public boolean isGroupingUsed()
Overrides:
isGroupingUsed in class NumberFormat

isParseIntegerOnly

public boolean isParseIntegerOnly()
Overrides:
isParseIntegerOnly in class NumberFormat

parse

public Number parse(String source,
                    ParsePosition parsePosition)
Specified by:
parse in class NumberFormat

parse

public Number parse(String source)
             throws ParseException
Overrides:
parse in class NumberFormat
Throws:
ParseException

parseObject

public Object parseObject(String source)
                   throws ParseException
Overrides:
parseObject in class Format
Throws:
ParseException

setCurrency

public void setCurrency(Currency currency)
Overrides:
setCurrency in class NumberFormat

setGroupingUsed

public void setGroupingUsed(boolean newValue)
Overrides:
setGroupingUsed in class NumberFormat

setMaximumFractionDigits

public void setMaximumFractionDigits(int newValue)
Overrides:
setMaximumFractionDigits in class NumberFormat

setMaximumIntegerDigits

public void setMaximumIntegerDigits(int newValue)
Overrides:
setMaximumIntegerDigits in class NumberFormat

setMinimumFractionDigits

public void setMinimumFractionDigits(int newValue)
Overrides:
setMinimumFractionDigits in class NumberFormat

setMinimumIntegerDigits

public void setMinimumIntegerDigits(int newValue)
Overrides:
setMinimumIntegerDigits in class NumberFormat

setParseIntegerOnly

public void setParseIntegerOnly(boolean value)
Overrides:
setParseIntegerOnly in class NumberFormat


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.