N
- public abstract class AbstractNumberConverter<N extends Number> extends AbstractConverter<N>
Constructor and Description |
---|
AbstractNumberConverter() |
Modifier and Type | Method and Description |
---|---|
String |
convertToString(N value,
Locale locale)
Converts the given value to a string.
|
NumberFormat |
getNumberFormat(Locale locale) |
protected abstract NumberFormat |
newNumberFormat(Locale locale)
Creates a new
NumberFormat 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.
|
getTargetType, newConversionException, parse
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
convertToObject
public NumberFormat getNumberFormat(Locale locale)
locale
- The localeprotected abstract NumberFormat newNumberFormat(Locale locale)
NumberFormat
for the given locale. The instance is later cached and is
accessible through getNumberFormat(Locale)
locale
- protected BigDecimal parse(Object value, BigDecimal min, BigDecimal max, Locale locale)
value
- The object to parse (after converting with toString())min
- The minimum allowed value or null
if nonemax
- The maximum allowed value or null
if nonelocale
- ConversionException
- if value is unparsable or out of rangepublic String convertToString(N value, Locale locale)
IConverter
convertToString
in interface IConverter<N extends Number>
convertToString
in class AbstractConverter<N extends Number>
value
- The value to convertlocale
- The locale used to convert the valueIConverter.convertToString(java.lang.Object, Locale)
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.