Module org.apache.wicket.util
Class AbstractNumberConverter<N extends Number>
java.lang.Object
org.apache.wicket.util.convert.converter.AbstractConverter<N>
org.apache.wicket.util.convert.converter.AbstractNumberConverter<N>
- Type Parameters:
N
-
- All Implemented Interfaces:
Serializable
,IConverter<N>
,IClusterable
- Direct Known Subclasses:
AbstractDecimalConverter
,AbstractIntegerConverter
Base class for all number converters.
- Author:
- Jonathan Locke
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionconvertToString
(N value, Locale locale) Converts the given value to a string.getNumberFormat
(Locale locale) protected abstract NumberFormat
newNumberFormat
(Locale locale) Creates a newNumberFormat
for the given locale.protected BigDecimal
parse
(Object value, BigDecimal min, BigDecimal max, 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 Details
-
AbstractNumberConverter
public AbstractNumberConverter()
-
-
Method Details
-
getNumberFormat
- Parameters:
locale
- The locale- Returns:
- Returns the numberFormat.
-
newNumberFormat
Creates a newNumberFormat
for the given locale. The instance is later cached and is accessible throughgetNumberFormat(Locale)
- Parameters:
locale
-- Returns:
- number format
-
parse
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 ornull
if nonemax
- The maximum allowed value ornull
if nonelocale
-- Returns:
- The number
- Throws:
ConversionException
- if value is unparsable or out of range
-
convertToString
Description copied from interface:IConverter
Converts the given value to a string.- Specified by:
convertToString
in interfaceIConverter<N extends Number>
- Overrides:
convertToString
in classAbstractConverter<N extends Number>
- Parameters:
value
- The value to convertlocale
- The locale used to convert the value- Returns:
- The converted string value
- See Also:
-