T
- the type in which the provided value has to be convertedpublic abstract class AbstractConverter<T> extends Object implements Converter<T>
Converter
component.
Commonly a new component is supposed to implements convertToString(Object)
and
convertToType(Class, Object)
.
Constructor and Description |
---|
AbstractConverter() |
Modifier and Type | Method and Description |
---|---|
<G> G |
convert(Type targetType,
Object sourceValue)
Convert the specified input object into an output object of the specified type.
|
protected String |
convertToString(T value)
Convert the input object into a String.
|
protected <G extends T> |
convertToType(Class<G> type,
Object value)
Deprecated.
since 3.0M1 overwrite
convertToType(Type, Object) instead |
protected <G extends T> |
convertToType(Type targetType,
Object value)
Convert the input object into an output object of the specified type.
|
public <G> G convert(Type targetType, Object sourceValue)
Converter
protected String convertToString(T value)
N.B.This implementation simply uses the value's toString()
method and should be overridden if
a more sophisticated mechanism for conversion to a String is required.
value
- The input value to be converted.protected <G extends T> G convertToType(Type targetType, Object value)
Typical implementations will provide a minimum of String --> type
conversion.
G
- the type in which the provided value has o be convertedtargetType
- Data type to which this value should be converted.value
- The input value to be converted.@Deprecated protected <G extends T> G convertToType(Class<G> type, Object value)
convertToType(Type, Object)
instead
Typical implementations will provide a minimum of String --> type
conversion.
G
- the type in which the provided value has o be convertedtype
- Data type to which this value should be converted.value
- The input value to be converted.Copyright © 2004–2021 XWiki. All rights reserved.