|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.red5.server.service.ConversionUtils
public class ConversionUtils
Misc utils for conversions
Constructor Summary | |
---|---|
ConversionUtils()
|
Method Summary | |
---|---|
static Object |
convert(Object source,
Class<?> target)
Convert source to given class |
static List<?> |
convertArrayToList(Object[] source)
|
static Set<?> |
convertArrayToSet(Object[] source)
Convert array to set, removing duplicates |
static Map<?,?> |
convertBeanToMap(Object source)
Convert bean to map |
static Object |
convertMapToBean(Map<?,?> source,
Class<?> target)
Convert map to bean |
static List<Object> |
convertMapToList(Map<?,?> map)
|
static Object |
convertNumberToWrapper(Number num,
Class<?> wrapper)
Convert number to primitive wrapper like Boolean or Float |
static Class<?>[] |
convertParams(Object[] source)
Convert parameters using methods of this utility class |
static Object[] |
convertParams(Object[] source,
Class<?>[] target)
Convert parameters using methods of this utility class |
static Object |
convertStringToWrapper(String str,
Class<?> wrapper)
Convert string to primitive wrapper like Boolean or Float |
static Object |
convertToArray(Object source,
Class<?> target)
Convert to array |
static Object |
convertToWrappedPrimitive(Object source,
Class<?> wrapper)
Convert to wrapped primitive |
static List<Method> |
findMethodsByNameAndNumParams(Object object,
String method,
int numParam)
Find method by name and number of parameters |
protected static Object |
newInstance(String className)
Create new class instance |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConversionUtils()
Method Detail |
---|
public static Object convert(Object source, Class<?> target) throws org.apache.commons.beanutils.ConversionException
source
- Source objecttarget
- Target class
org.apache.commons.beanutils.ConversionException
- If object can't be convertedpublic static Object convertToArray(Object source, Class<?> target) throws org.apache.commons.beanutils.ConversionException
source
- Source objecttarget
- Target class
org.apache.commons.beanutils.ConversionException
- If object can't be convertedpublic static List<Object> convertMapToList(Map<?,?> map)
public static Object convertToWrappedPrimitive(Object source, Class<?> wrapper)
source
- Source objectwrapper
- Primitive wrapper type
public static Object convertStringToWrapper(String str, Class<?> wrapper)
str
- String to convertwrapper
- Primitive wrapper type
public static Object convertNumberToWrapper(Number num, Class<?> wrapper)
num
- Number to converwrapper
- Primitive wrapper type
public static List<Method> findMethodsByNameAndNumParams(Object object, String method, int numParam)
object
- Object to find method onmethod
- Method namenumParam
- Number of parameters
public static Object[] convertParams(Object[] source, Class<?>[] target) throws org.apache.commons.beanutils.ConversionException
source
- Array of source objecttarget
- Array of target classes
org.apache.commons.beanutils.ConversionException
- If object can't be convertedpublic static Class<?>[] convertParams(Object[] source)
source
- Array of source object
public static List<?> convertArrayToList(Object[] source) throws org.apache.commons.beanutils.ConversionException
source
- source arra
org.apache.commons.beanutils.ConversionException
- on failurepublic static Object convertMapToBean(Map<?,?> source, Class<?> target) throws org.apache.commons.beanutils.ConversionException
source
- Source maptarget
- Target class
org.apache.commons.beanutils.ConversionException
- on failurepublic static Map<?,?> convertBeanToMap(Object source)
source
- Source bean
public static Set<?> convertArrayToSet(Object[] source)
source
- Source array
protected static Object newInstance(String className)
className
- Class name; may not be loaded by JVM yet
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |