net.sf.mmm.util.value.api
Interface SimpleValueConverter<SOURCE,TARGET>
- Type Parameters:
SOURCE - is the generic type of the object to be converted.TARGET - is the generic type of the result of the conversion.
- All Known Subinterfaces:
- ComposedValueConverter, ValueConverter<SOURCE,TARGET>
- All Known Implementing Classes:
- AbstractComposedValueConverter, AbstractConverterToArray, AbstractRecursiveValueConverter, AbstractSimpleValueConverter, AbstractValueConverter, AbstractValueConverterToContainer, CliClassContainer.CliModeFormatter, CliState.CliArgumentFormatter, ComposedValueConverterImpl, ComposedValueConverterImpl.ComposedTargetTypeConverter, DefaultComposedValueConverter, ValueConverterToArrayOfBoolean, ValueConverterToArrayOfByte, ValueConverterToArrayOfDouble, ValueConverterToArrayOfFloat, ValueConverterToArrayOfInt, ValueConverterToArrayOfLong, ValueConverterToArrayOfObject, ValueConverterToArrayOfShort, ValueConverterToBoolean, ValueConverterToCalendar, ValueConverterToClass, ValueConverterToCollection, ValueConverterToCompatiblePojo, ValueConverterToDate, ValueConverterToEnum, ValueConverterToFile, ValueConverterToMap, ValueConverterToNumber, ValueConverterToString
public interface SimpleValueConverter<SOURCE,TARGET>
This is the interface for a converter that
converts a value of the type
<SOURCE> to the type <TARGET>.
ATTENTION:
An implementation of this interface should be stateless and thread-safe.
- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
convert
TARGET convert(SOURCE value,
Object valueSource,
Class<? extends TARGET> targetClass)
throws ValueException
- This method converts the given
pojo to the
<TARGET>-type.
- Parameters:
value - is the value to convert.valueSource - describes the source of the value. This may be the
filename where the value was read from, an XPath where the value was
located in an XML document, etc. It is used in exceptions thrown if
something goes wrong. This will help to find the problem easier.targetClass - is the type to convert the value to.
- Returns:
- the converted
value or null if the
conversion is NOT possible. The returned value has to be an
instance of the given
targetType.
- Throws:
ValueException - if the conversion failed (e.g. the given
value is illegal for the given
targetClass).
Copyright © 2001-2010 mmm-Team. All Rights Reserved.