org.loom.converter
Interface Converter

All Superinterfaces:
FormInputDecorator
All Known Subinterfaces:
LocaleUnawareConverter
All Known Implementing Classes:
AbstractConverter, AbstractDecimalConverter, AbstractFormatConverter, AbstractSimpleConverter, AbstractSimpleNumberConverter, AbstractStringConverter, BigDecimalConverter, BooleanConverter, ByteConverter, CharacterConverter, DateConverter, DoubleConverter, EnumConverter, IntegerConverter, JsonConverter, LongConverter, MinutesConverter, NullConverter, ShortConverter, StringConverter

public interface Converter
extends FormInputDecorator

Makes the conversion between text and the java object that will be populated. Converters must be stateless and thread-safe. That means that they should not have private non-static attributes, unless you know what you are doing.


Method Summary
 java.lang.Object getAsObject(java.lang.String paramName, java.lang.String paramValue, Messages messages, MessagesRepository repository)
          Return the object value for the given text
 java.lang.String getAsText(java.lang.Object value, MessagesRepository repository)
          Return the text value for the given object
 java.lang.Class<?> getConvertedClass()
           
 
Methods inherited from interface org.loom.validator.FormInputDecorator
decorate
 

Method Detail

getAsObject

java.lang.Object getAsObject(java.lang.String paramName,
                             java.lang.String paramValue,
                             Messages messages,
                             MessagesRepository repository)
Return the object value for the given text

Parameters:
paramValue - the value that is being parsed
Returns:
the parsed value (can be null), maybe ading new values to the errors array

getAsText

java.lang.String getAsText(java.lang.Object value,
                           MessagesRepository repository)
Return the text value for the given object

Parameters:
value - the java object to convert to text
repository - the MessagesRepository object
Returns:
the parsed value (can be null)

getConvertedClass

java.lang.Class<?> getConvertedClass()
Returns:
the Class of the converted values.