public class AdaptiveNumberDatatype extends NumberDatatype implements Datatype<java.lang.Number>
NumberFormat
annotation.Modifier and Type | Field and Description |
---|---|
protected java.lang.Class<?> |
type |
decimalSeparator, formatPattern, groupingSeparator
Constructor and Description |
---|
AdaptiveNumberDatatype(java.lang.Class<?> type,
NumberFormat numberFormat) |
AdaptiveNumberDatatype(java.lang.Class<?> type,
java.lang.String pattern,
java.lang.String decimalSeparator,
java.lang.String groupingSeparator) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkIntegerRange(java.lang.String value,
java.lang.Number result) |
protected void |
checkLongRange(java.lang.String value,
java.lang.Number result) |
protected void |
checkRange(java.lang.String value,
java.lang.Number number) |
protected java.text.NumberFormat |
createFormat()
Creates non-localized format.
|
protected java.text.NumberFormat |
createLocalizedFormat(java.util.Locale locale) |
java.lang.String |
format(java.lang.Object value)
Converts value to String.
|
java.lang.String |
format(java.lang.Object value,
java.util.Locale locale)
Converts value to String taking into account local formats.
|
java.lang.Class |
getJavaClass()
Java class representing this Datatype
|
java.lang.Number |
parse(java.lang.String value)
Parses value from String.
|
java.lang.Number |
parse(java.lang.String value,
java.util.Locale locale)
Parses value from String taking into account local formats.
|
protected java.lang.Number |
requestedType(java.lang.Number number) |
protected void |
setupFormat(java.text.NumberFormat numberFormat) |
java.lang.String |
toString() |
getParameters, parse
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getName, getSqlType, read, write
public AdaptiveNumberDatatype(java.lang.Class<?> type, NumberFormat numberFormat)
public AdaptiveNumberDatatype(java.lang.Class<?> type, java.lang.String pattern, java.lang.String decimalSeparator, java.lang.String groupingSeparator)
protected java.text.NumberFormat createFormat()
NumberDatatype
createFormat
in class NumberDatatype
protected java.text.NumberFormat createLocalizedFormat(java.util.Locale locale)
protected void setupFormat(java.text.NumberFormat numberFormat)
public java.lang.Class getJavaClass()
Datatype
getJavaClass
in interface Datatype<java.lang.Number>
public java.lang.String format(java.lang.Object value)
Datatype
public java.lang.String format(java.lang.Object value, java.util.Locale locale)
Datatype
@Nullable public java.lang.Number parse(@Nullable java.lang.String value) throws java.text.ParseException
Datatype
ValueConversionException
instead of ParseException
.@Nullable public java.lang.Number parse(@Nullable java.lang.String value, java.util.Locale locale) throws java.text.ParseException
Datatype
ValueConversionException
instead of ParseException
.protected java.lang.Number requestedType(java.lang.Number number)
protected void checkRange(@Nullable java.lang.String value, java.lang.Number number) throws java.text.ParseException
java.text.ParseException
protected void checkIntegerRange(java.lang.String value, java.lang.Number result) throws java.text.ParseException
java.text.ParseException
protected void checkLongRange(java.lang.String value, java.lang.Number result) throws java.text.ParseException
java.text.ParseException
public java.lang.String toString()
toString
in class java.lang.Object