org.loom.converter
Class AbstractStringConverter

java.lang.Object
  extended by org.loom.converter.AbstractConverter
      extended by 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.


Field Summary
 
Fields inherited from class org.loom.converter.AbstractConverter
convertedClass, cssClass
 
Constructor Summary
protected AbstractStringConverter(java.lang.Class<?> convertedClass)
           
 
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()
           
<T extends AbstractStringConverter>
T
setNullValue(java.lang.Object nullValue)
           
 
Methods inherited from class org.loom.converter.AbstractConverter
addErrorMessage, decorate, getConvertedClass, getCssClass, setConvertedClass, setCssClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.loom.converter.Converter
getConvertedClass
 
Methods inherited from interface org.loom.validator.FormInputDecorator
decorate
 

Constructor Detail

AbstractStringConverter

protected AbstractStringConverter(java.lang.Class<?> convertedClass)
Method Detail

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 text
repository - 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)