public final class Converter extends Object
Modifier and Type | Method and Description |
---|---|
static void |
addConverter(Class<?> fromType,
Class<?> toType,
Convertable convertable)
Adds a converter.
|
static <T> T |
convert(Object value,
Class<T> toType)
Converts the supplied value to the supplied type.
|
public static void addConverter(Class<?> fromType, Class<?> toType, Convertable convertable)
fromType
- The type to convert from.toType
- The type to convert to.convertable
- The converter.NullPointerException
- When one of the supplied parameters is null.public static <T> T convert(Object value, Class<T> toType)
T
- The type to convert.value
- The value to convert.toType
- The type to convert to.NullPointerException
- When the supplied toType is null.UnsupportedOperationException
- When no converter exists to convert the supplied value to the supplied toType.Copyright © 2008–2018. All rights reserved.