|
intarsys runtime library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.intarsys.tools.reflect.ObjectTools
public class ObjectTools
A tool class for convenient object related tasks.
This tool contains some simple reflection implementations.
Field Summary | |
---|---|
static String |
GET_PREFIX
|
static String |
IS_PREFIX
|
Constructor Summary | |
---|---|
ObjectTools()
|
Method Summary | ||
---|---|---|
static
|
createObject(Class clazz,
Class<T> expectedClass)
Create a new instance of Class "class" |
|
static
|
createObject(Class clazz,
Class<T> expectedClass,
Class[] parameterTypes,
Object[] parameters)
Create a new instance of Class "class" |
|
static
|
createObject(String className,
Class<T> expectedClass,
ClassLoader classLoader)
Create a new instance of Class "className" via "classLoader". |
|
static Method |
findGetter(Object object,
String name)
|
|
static Method |
findInserter(Object object,
String attribute,
Object value)
|
|
static Method |
findMethod(Object object,
String methodName,
Object... parameters)
|
|
static Method |
findRemover(Object object,
String attribute,
Object value)
|
|
static Method |
findSetter(Object object,
String attribute,
Object value)
|
|
static Object |
get(Object object,
String name)
Get the value for field name in object . |
|
static Object |
insert(Object object,
String name,
Object value)
Insert value in the relation field name in
object . |
|
static Object |
invoke(Object object,
String name,
Object... values)
Invoke method name in object . |
|
static Object |
remove(Object object,
String name,
Object value)
Remove value in the relation field name in
object . |
|
static Object |
set(Object object,
String name,
Object value)
Set field name in object to
value . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String GET_PREFIX
public static final String IS_PREFIX
Constructor Detail |
---|
public ObjectTools()
Method Detail |
---|
public static <T> T createObject(Class clazz, Class<T> expectedClass) throws ObjectCreationException
className
- expectedClass
- classLoader
-
ObjectCreationException
public static <T> T createObject(Class clazz, Class<T> expectedClass, Class[] parameterTypes, Object[] parameters) throws ObjectCreationException
className
- expectedClass
- parameterTypes
- parameters
-
ObjectCreationException
public static <T> T createObject(String className, Class<T> expectedClass, ClassLoader classLoader) throws ObjectCreationException
className
- expectedClass
- classLoader
-
ObjectCreationException
public static Method findGetter(Object object, String name) throws SecurityException, NoSuchMethodException
SecurityException
NoSuchMethodException
public static Method findInserter(Object object, String attribute, Object value) throws SecurityException, NoSuchMethodException
SecurityException
NoSuchMethodException
public static Method findMethod(Object object, String methodName, Object... parameters) throws SecurityException, NoSuchMethodException
SecurityException
NoSuchMethodException
public static Method findRemover(Object object, String attribute, Object value) throws SecurityException, NoSuchMethodException
SecurityException
NoSuchMethodException
public static Method findSetter(Object object, String attribute, Object value) throws SecurityException, NoSuchMethodException
SecurityException
NoSuchMethodException
public static Object get(Object object, String name) throws IllegalAccessException, InvocationTargetException, NoSuchFieldException
name
in object
.
object
- name
-
IllegalAccessException
InvocationTargetException
NoSuchFieldException
public static Object insert(Object object, String name, Object value) throws IllegalAccessException, InvocationTargetException, NoSuchFieldException
value
in the relation field name
in
object
. The value that was really inserted is returned
(if supported by the underlying object implementation). To be exact, the
result of the insert method invoked is returned.
object
- name
- value
-
IllegalAccessException
InvocationTargetException
NoSuchFieldException
public static Object invoke(Object object, String name, Object... values) throws IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException, NoSuchFieldException
name
in object
. The result
of the invocation is returned.
object
- name
- values
-
IllegalAccessException
InvocationTargetException
SecurityException
NoSuchMethodException
NoSuchFieldException
public static Object remove(Object object, String name, Object value) throws IllegalAccessException, InvocationTargetException, NoSuchFieldException
value
in the relation field name
in
object
. The value that was removed is returned (if
supported by the underlying object implementation). To be exact, the
result of the remove method invoked is returned.
object
- name
- value
-
IllegalAccessException
InvocationTargetException
NoSuchFieldException
public static Object set(Object object, String name, Object value) throws IllegalAccessException, InvocationTargetException, NoSuchFieldException
name
in object
to
value
. The old value is returned (if supported by the
underlying object implementation). To be exact, the result of the setter
method invoked is returned.
object
- name
- value
-
IllegalAccessException
InvocationTargetException
NoSuchFieldException
|
intarsys runtime library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |