Class AbstractConverter<C>
- java.lang.Object
-
- org.apache.wicket.util.convert.converter.AbstractConverter<C>
-
- Type Parameters:
C-
- All Implemented Interfaces:
Serializable,IConverter<C>,IClusterable
- Direct Known Subclasses:
AbstractDateConverter,AbstractJavaTimeConverter,AbstractNumberConverter,BooleanConverter,CharacterConverter
public abstract class AbstractConverter<C> extends Object implements IConverter<C>
Base class for locale aware type converters.- Author:
- Eelco Hillenius
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractConverter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description StringconvertToString(C value, Locale locale)Converts the given value to a string.protected abstract Class<C>getTargetType()protected ConversionExceptionnewConversionException(String message, Object value, Locale locale)Creates a conversion exception for throwingprotected Cparse(Format format, Object value, Locale locale)Parses a value using one of the java.util.text format classes.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.wicket.util.convert.IConverter
convertToObject
-
-
-
-
Constructor Detail
-
AbstractConverter
public AbstractConverter()
-
-
Method Detail
-
parse
protected C parse(Format format, Object value, Locale locale)
Parses a value using one of the java.util.text format classes.- Parameters:
format- The format to usevalue- The object to parselocale- The locale to use to parse.- Returns:
- The object
- Throws:
ConversionException- Thrown if parsing fails
-
newConversionException
protected ConversionException newConversionException(String message, Object value, Locale locale)
Creates a conversion exception for throwing- Parameters:
message- The messagevalue- The value that didn't convertlocale- The locale- Returns:
- The ConversionException
-
getTargetType
protected abstract Class<C> getTargetType()
- Returns:
- The target type of this type converter
-
convertToString
public String convertToString(C value, Locale locale)
Description copied from interface:IConverterConverts the given value to a string.- Specified by:
convertToStringin interfaceIConverter<C>- Parameters:
value- The value to convertlocale- The locale used to convert the value- Returns:
- The converted string value
- See Also:
IConverter.convertToString(java.lang.Object, Locale)
-
-