M - model typepublic class StringConverter<M> extends Object implements AttributeConverter<M,String>
<bean id="StringConverter"
class="no.g9.client.core.converter.StringConverter">
<property name="modelTypeClass" value="java.util.Date" />
<property name="format" value="{0,date,yyyy-MM-dd}" />
</bean>
This bean is configurable through the following properties:
<li> modelTypeClass: Qualified class name of model type
<li> format: Format rule, @see java.text.MessageFormat| Constructor and Description |
|---|
StringConverter() |
| Modifier and Type | Method and Description |
|---|---|
String |
fromModel(Object value,
ConvertContext context) |
Class<M> |
getModelType() |
Class<String> |
getTargetType() |
void |
setFormat(String format)
Sets the format to apply
|
void |
setModelTypeClass(String className)
Sets model type class from name
|
M |
toModel(String value,
ConvertContext context) |
public void setModelTypeClass(String className)
className - Qualified name of the model type classG9BaseException - If class not foundpublic void setFormat(String format)
format - the format to setpublic Class<M> getModelType()
getModelType in interface AttributeConverter<M,String>public Class<String> getTargetType()
getTargetType in interface AttributeConverter<M,String>public M toModel(String value, ConvertContext context) throws ConvertException
toModel in interface Converter<M,String>ConvertExceptionpublic String fromModel(Object value, ConvertContext context) throws ConvertException
fromModel in interface Converter<M,String>ConvertExceptionCopyright © 2006–2020 Esito AS. All rights reserved.