aQute.lib.converter
Class Converter
java.lang.Object
aQute.lib.converter.Converter
public class Converter
- extends Object
General Java type converter from an object to any type. Supports number
conversion
- Author:
- aqute
|
Method Summary |
Object |
array(Type type,
Object o)
|
static
|
cnv(Class<T> tr,
Object source)
|
static Object |
cnv(Type tr,
Object source)
|
static
|
cnv(TypeReference<T> tr,
Object source)
|
|
convert(Class<T> type,
Object o)
|
Object |
convert(Type type,
Object o)
|
|
convert(TypeReference<T> type,
Object o)
|
Converter |
hook(Type type,
Converter.Hook hook)
|
static String |
mangleMethodName(String id)
|
|
proxy(Class<T> interfc,
Map<?,?> properties)
Convert a map to an interface. |
void |
setFatalIsException(boolean b)
|
Collection<?> |
toCollection(Object o)
|
Map<?,?> |
toMap(Object o)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Converter
public Converter()
convert
public <T> T convert(Class<T> type,
Object o)
throws Exception
- Throws:
Exception
convert
public <T> T convert(TypeReference<T> type,
Object o)
throws Exception
- Throws:
Exception
convert
public Object convert(Type type,
Object o)
throws Exception
- Throws:
Exception
array
public Object array(Type type,
Object o)
throws Exception
- Throws:
Exception
toCollection
public Collection<?> toCollection(Object o)
toMap
public Map<?,?> toMap(Object o)
throws Exception
- Throws:
Exception
setFatalIsException
public void setFatalIsException(boolean b)
hook
public Converter hook(Type type,
Converter.Hook hook)
proxy
public <T> T proxy(Class<T> interfc,
Map<?,?> properties)
- Convert a map to an interface.
- Parameters:
interfc - properties -
- Returns:
mangleMethodName
public static String mangleMethodName(String id)
cnv
public static <T> T cnv(TypeReference<T> tr,
Object source)
throws Exception
- Throws:
Exception
cnv
public static <T> T cnv(Class<T> tr,
Object source)
throws Exception
- Throws:
Exception
cnv
public static Object cnv(Type tr,
Object source)
throws Exception
- Throws:
Exception
Copyright © 2014 aQute SARL. All rights reserved.