Package org.xwiki.properties.converter
Interface Converter<T>
-
- Type Parameters:
T
- the type in which the provided value has to be converted
- All Known Implementing Classes:
AbstractCollectionConverter
,AbstractConverter
,AbstractSetConverter
@Role public interface Converter<T>
General purpose data type converter that can be registered and used within the frameworks likeConverterManager
andBeanManager
package to manage the conversion of objects from one type to another.The type supported by the converted is indicated in its role.
For example:
@Component public class IntegerConverter implements Converter<java.lang.Integer>
If a conversion cannot be performed successfully the converter is expected to throw a
ConversionException
.- Since:
- 2.0M2
- Version:
- $Id: 70432c7f19580e385f58271945cf3df31155067a $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <G> G
convert(Type targetType, Object sourceValue)
Convert the specified input object into an output object of the specified type.
-
-
-
Method Detail
-
convert
<G> G convert(Type targetType, Object sourceValue)
Convert the specified input object into an output object of the specified type.- Type Parameters:
G
- 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
- Throws:
ConversionException
- if conversion cannot be performed successfully- Since:
- 3.0M1
-
-