public abstract class ConversionUtil extends Object
Constructor and Description |
---|
ConversionUtil() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
getAs(Object value,
Class<T> targetType)
Convert a given value to the given target type.
|
static <T> List<T> |
getAsList(Object value,
Class<T> targetType,
boolean flatten)
Convert a given value to a collection of target type values.
|
public static <T> T getAs(Object value, Class<T> targetType) throws org.springframework.core.convert.ConversionException
value
- the value to converttargetType
- the target typeorg.springframework.core.convert.ConversionException
- if the conversion failedpublic static <T> List<T> getAsList(Object value, Class<T> targetType, boolean flatten) throws org.springframework.core.convert.ConversionException
value
- the value to converttargetType
- the target element typeflatten
- if the collection shall be flattened, i.e. if it in turn
contains a collection instead the converted values are addednull
or an empty collectionorg.springframework.core.convert.ConversionException
- if the conversion failsBuild 2013-10-07_11-27-38
Revision 99b27713a799a59a21b0b166eaaea8aaefbf125a