org.loom.converter
Class AbstractStringConverter
java.lang.Object
org.loom.converter.AbstractConverter
org.loom.converter.AbstractStringConverter
- All Implemented Interfaces:
- Converter, FormInputDecorator
- Direct Known Subclasses:
- AbstractFormatConverter, AbstractSimpleConverter, AbstractSimpleNumberConverter
public abstract class AbstractStringConverter
- extends AbstractConverter
- implements Converter
A class that must be able to perform the conversion from and to
a String value.
Method Summary |
java.lang.Object |
getAsObject(java.lang.String name,
java.lang.String value,
Messages messages,
MessagesRepository repository)
Return the object value for the given text |
protected abstract java.lang.Object |
getAsObjectImpl(java.lang.String name,
java.lang.String value,
Messages messages,
MessagesRepository repository)
This method is the getAsObject implementation, and has the guarantee that the value is not null |
java.lang.String |
getAsText(java.lang.Object value,
MessagesRepository repository)
Return the text value for the given object |
protected java.lang.String |
getAsTextImpl(java.lang.Object value,
MessagesRepository repository)
This method is the getAsText implementation, and has the guarantee that the value is not null |
java.lang.Object |
getNullValue()
|
|
setNullValue(java.lang.Object nullValue)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractStringConverter
protected AbstractStringConverter(java.lang.Class<?> convertedClass)
getAsObject
public java.lang.Object getAsObject(java.lang.String name,
java.lang.String value,
Messages messages,
MessagesRepository repository)
- Return the object value for the given text
- Specified by:
getAsObject
in interface Converter
- Parameters:
value
- the value that is being parsed
- Returns:
- the parsed value (can be null), maybe ading new values to the errors array
getAsObjectImpl
protected abstract java.lang.Object getAsObjectImpl(java.lang.String name,
java.lang.String value,
Messages messages,
MessagesRepository repository)
- This method is the getAsObject implementation, and has the guarantee that the value is not null
getAsText
public final java.lang.String getAsText(java.lang.Object value,
MessagesRepository repository)
- Return the text value for the given object
- Specified by:
getAsText
in interface Converter
- Parameters:
value
- the java object to convert to textrepository
- the MessagesRepository object
- Returns:
- the parsed value (can be null)
getAsTextImpl
protected java.lang.String getAsTextImpl(java.lang.Object value,
MessagesRepository repository)
- This method is the getAsText implementation, and has the guarantee that the value is not null
getNullValue
public java.lang.Object getNullValue()
setNullValue
public <T extends AbstractStringConverter> T setNullValue(java.lang.Object nullValue)