|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xwiki.properties.converter.AbstractConverter<T>
T - the type in which the provided value has to be convertedpublic abstract class AbstractConverter<T>
Helper base class for a Converter component.
Commonly a new component is supposed to implements convertToString(Object) and
convertToType(Class, Object).
| Constructor Summary | |
|---|---|
AbstractConverter()
|
|
| Method Summary | ||
|---|---|---|
|
convert(Type targetType,
Object sourceValue)
|
|
protected String |
convertToString(T value)
Convert the input object into a String. |
|
protected
|
convertToType(Class<G> type,
Object value)
Deprecated. since 3.0M1 overwrite convertToType(Type, Object) instead |
|
protected
|
convertToType(Type targetType,
Object value)
Convert the input object into an output object of the specified type. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractConverter()
| Method Detail |
|---|
public <G> G convert(Type targetType,
Object sourceValue)
convert in interface Converter<T>G - the type in which the provided value has to be convertedtargetType - the type in which the provided value has to be convertedsourceValue - the value to convert
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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||