|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.util.ObjectUtil
public class ObjectUtil
| Field Summary | |
|---|---|
protected static Integer |
ZERO
|
protected static Byte |
ZEROB
|
protected static Character |
ZEROC
|
protected static Double |
ZEROD
|
protected static Float |
ZEROF
|
protected static Long |
ZEROL
|
| Method Summary | ||
|---|---|---|
static Object |
call(Object o,
Method m,
String... params)
Call method m with params as String. |
|
protected static Object |
convert(String v,
Class<?> clazz)
|
|
static Object |
create(String classnameAndProperties)
Create new object from string like org.nuiton.Toto(name=machine, int=10) where machine and int is properties on org.nuiton.Toto object. |
|
static
|
getConstructor(Class<T> clazz,
int paramNumber)
Get all constructors that support paramNumber as parameters numbers. |
|
static List<Method> |
getMethod(Class<?> clazz,
String methodName,
boolean ignoreCase)
Get all methods with name given in argument without check parameters |
|
static Object |
getNullValue(Class<?> type)
Obtains the null value for the given type (works too with primitive types). |
|
static boolean |
isNullValue(boolean value)
|
|
static boolean |
isNullValue(byte value)
|
|
static boolean |
isNullValue(char value)
|
|
static boolean |
isNullValue(double value)
|
|
static boolean |
isNullValue(float value)
|
|
static boolean |
isNullValue(int value)
|
|
static boolean |
isNullValue(Object value)
Tests if the given value is null according to default value for primitive types if nedded. |
|
static
|
newInstance(Class<T> clazz,
String... params)
Create new instance of clazz, call constructor with params as String. |
|
static Object |
newInstance(String constructorWithParams)
|
|
static Object |
toObject(boolean b)
Method toObject transform a boolean to a Boolean object |
|
static Object |
toObject(byte b)
Method toObject transform a byte to a Byte Object |
|
static Object |
toObject(char c)
Method toObject transform a char to a Character Object |
|
static Object |
toObject(double d)
Method toObject transform a double to a Double object |
|
static Object |
toObject(float f)
Method toObject transform a float to a Float Object |
|
static Object |
toObject(int i)
Method toObject transform an int to an Integer object |
|
static Object |
toObject(long l)
Method toObject transform a long to a Long object |
|
static Object |
toObject(Object o)
Method toObject |
|
static Object |
toObject(short s)
Method toObject transform a short to a Short object |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final Integer ZERO
protected static final Character ZEROC
protected static final Float ZEROF
protected static final Long ZEROL
protected static final Double ZEROD
protected static final Byte ZEROB
| Method Detail |
|---|
public static Object create(String classnameAndProperties)
throws ClassNotFoundException,
InstantiationException,
IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
classnameAndProperties -
ClassNotFoundException
IllegalAccessException
InstantiationException
NoSuchMethodException
InvocationTargetException
protected static Object convert(String v,
Class<?> clazz)
public static Object call(Object o,
Method m,
String... params)
throws IllegalAccessException,
IllegalArgumentException,
InvocationTargetException,
InstantiationException
o - object where method must be callm - method to callparams - parameters for method call
IllegalAccessException
IllegalArgumentException
InvocationTargetException
InstantiationException
public static List<Method> getMethod(Class<?> clazz,
String methodName,
boolean ignoreCase)
clazz - methodName - method name to searchignoreCase - if true, ignore difference in method name case
public static Object newInstance(String constructorWithParams)
throws ClassNotFoundException
ClassNotFoundException
public static <T> T newInstance(Class<T> clazz,
String... params)
throws IllegalArgumentException
T - type to instanciateclazz - class to instanciateparams - parameters for constructor call
IllegalArgumentException
public static <T> List<Constructor<T>> getConstructor(Class<T> clazz,
int paramNumber)
T - le type de la classe a inspecterclazz - la classe sur lequel rechercher le constructeurparamNumber - le nombre de parametre souhaite pour le constructeur,
-1 indique que tous les constructeur sont souhaite.
public static Object toObject(Object o)
o - Object to transform
public static Object toObject(char c)
c - the char to transform
public static Object toObject(byte b)
b - the byte to transform
public static Object toObject(short s)
s - the short to transform
public static Object toObject(int i)
i - the int to transform
public static Object toObject(long l)
l - the long to transform
public static Object toObject(float f)
f - the float to transform
public static Object toObject(double d)
d - the double to transform
public static Object toObject(boolean b)
b - the boolean to transform
public static Object getNullValue(Class<?> type)
type - the type to test
null value or default value for primitive typespublic static boolean isNullValue(Object value)
value - the value to test
true if value is null or default value on a primitivepublic static boolean isNullValue(boolean value)
public static boolean isNullValue(byte value)
public static boolean isNullValue(int value)
public static boolean isNullValue(char value)
public static boolean isNullValue(float value)
public static boolean isNullValue(double value)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||