|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xwiki.properties.converter.AbstractConverter
public abstract class AbstractConverter
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(Object value)
Convert the input object into a String. |
|
protected
|
convertToType(Class<T> 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 <T> T convert(Type targetType,
Object sourceValue)
convert in interface ConverterT - 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(Object 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 <T> T convertToType(Type targetType,
Object value)
Typical implementations will provide a minimum of String --> type conversion.
T - 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 <T> T convertToType(Class<T> type,
Object value)
convertToType(Type, Object) instead
Typical implementations will provide a minimum of String --> type conversion.
T - 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 | |||||||||