org.apache.wicket.util.convert.converter
Class AbstractNumberConverter<N extends java.lang.Number>

java.lang.Object
  extended by org.apache.wicket.util.convert.converter.AbstractConverter<N>
      extended by org.apache.wicket.util.convert.converter.AbstractNumberConverter<N>
Type Parameters:
N -
All Implemented Interfaces:
java.io.Serializable, IClusterable, IConverter<N>
Direct Known Subclasses:
AbstractDecimalConverter, AbstractIntegerConverter

public abstract class AbstractNumberConverter<N extends java.lang.Number>
extends AbstractConverter<N>

Base class for all number converters.

Author:
Jonathan Locke
See Also:
Serialized Form

Constructor Summary
AbstractNumberConverter()
           
 
Method Summary
 java.lang.String convertToString(N value, java.util.Locale locale)
          Converts the given value to a string.
abstract  java.text.NumberFormat getNumberFormat(java.util.Locale locale)
           
protected  N parse(java.lang.Object value, double min, double max, java.util.Locale locale)
          Parses a value as a String and returns a Number.
 
Methods inherited from class org.apache.wicket.util.convert.converter.AbstractConverter
getTargetType, newConversionException, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.wicket.util.convert.IConverter
convertToObject
 

Constructor Detail

AbstractNumberConverter

public AbstractNumberConverter()
Method Detail

getNumberFormat

public abstract java.text.NumberFormat getNumberFormat(java.util.Locale locale)
Parameters:
locale -
Returns:
Returns the numberFormat.

parse

protected N parse(java.lang.Object value,
                  double min,
                  double max,
                  java.util.Locale locale)
Parses a value as a String and returns a Number.

Parameters:
value - The object to parse (after converting with toString())
min - The minimum allowed value
max - The maximum allowed value
locale -
Returns:
The number
Throws:
ConversionException - if value is unparsable or out of range

convertToString

public java.lang.String convertToString(N value,
                                        java.util.Locale locale)
Description copied from interface: IConverter
Converts the given value to a string.

Specified by:
convertToString in interface IConverter<N extends java.lang.Number>
Overrides:
convertToString in class AbstractConverter<N extends java.lang.Number>
Parameters:
value - The value to convert
locale - The locale used to convert the value
Returns:
The converted string value
See Also:
IConverter.convertToString(java.lang.Object, Locale)


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.