C
- The object to convert from and to Stringpublic interface IConverter<C> extends IClusterable
Output conversion, which is handled by convertToString(Object, Locale)
, is typically
used by components when they render, so that a date can be displayed as '12/12/2007'. Input
conversion, handled by convertToObject(String, Locale)
, is typically used by form
components to interpret incoming values Such values are strings as they are send as request
parameters from browsers. An incoming value could be the string '12/12/2007' which could be
translated to a corresponding Date
object.
Notice that incoming value, when used by a FormComponent, will never be null because before
validation form components perform the required (see FormComponent.isRequired()) check which
errors out on null values. In the case the FormComponent is not required and the user enters a
null value converters will not be invoked because no type conversion is necessary.
Component.getConverter(Class)
,
Application.getConverterLocator()
Modifier and Type | Method and Description |
---|---|
C |
convertToObject(String value,
Locale locale)
Converts the given
String value |
String |
convertToString(C value,
Locale locale)
Converts the given value to a string.
|
C convertToObject(String value, Locale locale) throws ConversionException
String
valuevalue
- The string value to convertlocale
- The locale used to convert the valueConversionException
- if value could not be convertedCopyright © 2006–2021 Apache Software Foundation. All rights reserved.