com.amazon.carbonado.util
Class Converter
java.lang.Object
com.amazon.carbonado.util.Converter
public abstract class Converter
- extends Object
General purpose type converter. Custom conversions are possible by supplying
an abstract subclass which has public conversion methods whose names begin
with "convert". Each conversion method takes a single argument and returns a
value.
- Since:
- 1.2
- Author:
- Brian S O'Neill
|
Method Summary |
static
|
build(Class<C> converterType)
|
static
|
buildClass(Class<C> converterType)
|
protected IllegalArgumentException |
conversionNotSupported(Object fromValue,
Class fromType,
Class toType)
|
abstract
|
convert(boolean from,
Class<T> toType)
|
abstract
|
convert(byte from,
Class<T> toType)
|
abstract
|
convert(char from,
Class<T> toType)
|
abstract
|
convert(double from,
Class<T> toType)
|
abstract
|
convert(float from,
Class<T> toType)
|
abstract
|
convert(int from,
Class<T> toType)
|
abstract
|
convert(long from,
Class<T> toType)
|
abstract
|
convert(Object from,
Class<T> toType)
|
abstract
|
convert(short from,
Class<T> toType)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Converter
public Converter()
build
public static <C extends Converter> C build(Class<C> converterType)
- Parameters:
converterType - type of converter to generate
- Throws:
IllegalArgumentException - if converter doesn't a no-arg constructor
buildClass
public static <C extends Converter> Class<? extends C> buildClass(Class<C> converterType)
- Parameters:
converterType - type of converter to generate
convert
public abstract <T> T convert(Object from,
Class<T> toType)
- Throws:
IllegalArgumentException - if conversion is not supported
convert
public abstract <T> T convert(byte from,
Class<T> toType)
- Throws:
IllegalArgumentException - if conversion is not supported
convert
public abstract <T> T convert(short from,
Class<T> toType)
- Throws:
IllegalArgumentException - if conversion is not supported
convert
public abstract <T> T convert(int from,
Class<T> toType)
- Throws:
IllegalArgumentException - if conversion is not supported
convert
public abstract <T> T convert(long from,
Class<T> toType)
- Throws:
IllegalArgumentException - if conversion is not supported
convert
public abstract <T> T convert(float from,
Class<T> toType)
- Throws:
IllegalArgumentException - if conversion is not supported
convert
public abstract <T> T convert(double from,
Class<T> toType)
- Throws:
IllegalArgumentException - if conversion is not supported
convert
public abstract <T> T convert(boolean from,
Class<T> toType)
- Throws:
IllegalArgumentException - if conversion is not supported
convert
public abstract <T> T convert(char from,
Class<T> toType)
- Throws:
IllegalArgumentException - if conversion is not supported
conversionNotSupported
protected IllegalArgumentException conversionNotSupported(Object fromValue,
Class fromType,
Class toType)
Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.