org.xwiki.properties.internal.converter
Class ConvertUtilsConverter
java.lang.Object
org.xwiki.properties.internal.converter.ConvertUtilsConverter
- All Implemented Interfaces:
- Initializable, Converter
@Component
@Singleton
public class ConvertUtilsConverter
- extends Object
- implements Converter, Initializable
ConvertUtils based converter.
It's the default Converter, the one used when no other Converter could be found by
ConverterManager.
- Since:
- 2.0M2
- Version:
- $Id$
|
Method Summary |
|
convert(Type targetType,
Object sourceValue)
|
void |
initialize()
By default ConvertUtils.convert(Object, Class) does not throw any exceptions for failed conversions. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConvertUtilsConverter
public ConvertUtilsConverter()
initialize
public void initialize()
- By default
ConvertUtils.convert(Object, Class) does not throw any exceptions for failed conversions.
Instead it will return some default value corresponding to the target type. We must override this behavior in
order to get the desired functionality.
- Specified by:
initialize in interface Initializable
convert
public <T> T convert(Type targetType,
Object sourceValue)
-
- Specified by:
convert in interface Converter
- Type Parameters:
T - the type in which the provided value has to be converted- Parameters:
targetType - the type in which the provided value has to be convertedsourceValue - the value to convert
- Returns:
- the converted value
- See Also:
Converter.convert(java.lang.reflect.Type, java.lang.Object)
Copyright © 2004-2011 XWiki. All Rights Reserved.