|
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 Object |
basicGet(Object object,
String name)
|
|
static Object |
basicInsert(Object object,
String name,
Object value)
|
|
static Object |
basicInvoke(Object object,
String name,
Object... values)
|
|
static Object |
basicRemove(Object object,
String name,
Object value)
|
|
static Object |
basicSet(Object object,
String name,
Object value)
|
|
static Object |
convert(Object value,
String typeName,
ClassLoader classLoader)
|
|
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 |
findMethodPrefixed(Object object,
String methodPrefix,
Object... parameters)
|
|
static Method |
findRegister(Object object,
Object value)
|
|
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 boolean |
isAssignable(Class target,
Class source)
|
|
static Object |
register(Object registry,
Object value)
|
|
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 Object basicGet(Object object,
String name)
throws FieldException
FieldException
public static Object basicInsert(Object object,
String name,
Object value)
throws FieldException
FieldException
public static Object basicInvoke(Object object,
String name,
Object... values)
throws MethodException
MethodException
public static Object basicRemove(Object object,
String name,
Object value)
throws FieldException
FieldException
public static Object basicSet(Object object,
String name,
Object value)
throws FieldException
FieldException
public static Object convert(Object value,
String typeName,
ClassLoader classLoader)
throws ObjectCreationException
ObjectCreationException
public static <T> T createObject(Class clazz,
Class<T> expectedClass)
throws ObjectCreationException
clazz - expectedClass -
ObjectCreationException
public static <T> T createObject(Class clazz,
Class<T> expectedClass,
Class[] parameterTypes,
Object[] parameters)
throws ObjectCreationException
clazz - 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 MethodException
MethodException
public static Method findInserter(Object object,
String attribute,
Object value)
throws MethodException
MethodException
public static Method findMethod(Object object,
String methodName,
Object... parameters)
throws MethodException
MethodException
public static Method findMethodPrefixed(Object object,
String methodPrefix,
Object... parameters)
throws MethodException
MethodException
public static Method findRegister(Object object,
Object value)
throws MethodException
MethodException
public static Method findRemover(Object object,
String attribute,
Object value)
throws MethodException
MethodException
public static Method findSetter(Object object,
String attribute,
Object value)
throws MethodException
MethodException
public static Object get(Object object,
String name)
throws FieldException
name in object.
object - name -
name in object.
IllegalAccessException
InvocationTargetException
NoSuchFieldException
FieldException
public static Object insert(Object object,
String name,
Object value)
throws FieldException
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
FieldException
public static Object invoke(Object object,
String name,
Object... values)
throws MethodException
name in object. The result of the
invocation is returned.
object - name - values -
MethodException
public static boolean isAssignable(Class target,
Class source)
public static Object register(Object registry,
Object value)
throws MethodException
MethodException
public static Object remove(Object object,
String name,
Object value)
throws FieldException
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
FieldException
public static Object set(Object object,
String name,
Object value)
throws FieldException
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
FieldException
|
intarsys runtime library | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||