M - the model type, either Integer/Long or the model type of the chained converterpublic class NumberConverter<M> extends Object implements AttributeConverter<M,String>
| Constructor and Description |
|---|
NumberConverter(AttributeConverter<M,Number> chainedConverter,
Class<M> modelType)
Create a new converter with the given chained converter.
|
NumberConverter(Class<M> modelType)
Create a new converter without a chained converter.
|
| Modifier and Type | Method and Description |
|---|---|
String |
fromModel(M value,
ConvertContext context) |
Class<M> |
getModelType() |
Class<String> |
getTargetType() |
M |
toModel(String value,
ConvertContext context) |
public NumberConverter(Class<M> modelType)
modelType - the model type to use, either Integer or Longpublic NumberConverter(AttributeConverter<M,Number> chainedConverter, Class<M> modelType)
chainedConverter - the chained converter, or nullmodelType - the model type to use if no chained converter is given, either Integer or Longpublic String fromModel(M value, ConvertContext context) throws ConvertException
fromModel in interface Converter<M,String>ConvertExceptionpublic M toModel(String value, ConvertContext context) throws ConvertException
toModel in interface Converter<M,String>ConvertExceptionpublic Class<String> getTargetType()
getTargetType in interface AttributeConverter<M,String>public Class<M> getModelType()
getModelType in interface AttributeConverter<M,String>Copyright © 2006–2017 Esito AS. All rights reserved.