org.red5.server.util
public class ConversionUtils extends Object
Constructor and Description |
---|
ConversionUtils() |
Modifier and Type | Method and Description |
---|---|
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
|
public static Object convert(Object source, Class<?> target) throws org.apache.commons.beanutils.ConversionException
source
- Source objecttarget
- Target classorg.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 classorg.apache.commons.beanutils.ConversionException
- If object can't be convertedpublic static Object convertToWrappedPrimitive(Object source, Class<?> wrapper)
source
- Source objectwrapper
- Primitive wrapper typepublic static Object convertStringToWrapper(String str, Class<?> wrapper)
str
- String to convertwrapper
- Primitive wrapper typepublic static Object convertNumberToWrapper(Number num, Class<?> wrapper)
num
- Number to converwrapper
- Primitive wrapper typepublic static List<Method> findMethodsByNameAndNumParams(Object object, String method, int numParam)
object
- Object to find method onmethod
- Method namenumParam
- Number of parameterspublic static Object[] convertParams(Object[] source, Class<?>[] target) throws org.apache.commons.beanutils.ConversionException
source
- Array of source objecttarget
- Array of target classesorg.apache.commons.beanutils.ConversionException
- If object can't be convertedpublic static Class<?>[] convertParams(Object[] source)
source
- Array of source objectpublic static List<?> convertArrayToList(Object[] source) throws org.apache.commons.beanutils.ConversionException
source
- source arraorg.apache.commons.beanutils.ConversionException
- on failurepublic static Object convertMapToBean(Map<?,?> source, Class<?> target) throws org.apache.commons.beanutils.ConversionException
source
- Source maptarget
- Target classorg.apache.commons.beanutils.ConversionException
- on failurepublic static Map<?,?> convertBeanToMap(Object source)
source
- Source beanpublic static Set<?> convertArrayToSet(Object[] source)
source
- Source arrayCopyright © 2006-2012 The Red5 Project