|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.lip6.sma.simulacion.test.PrivateAccessor
public final class PrivateAccessor
Class to access private/protected fields and methods for testing purposes.
| Constructor Summary | |
|---|---|
private |
PrivateAccessor()
Default constructor. |
| Method Summary | |
|---|---|
private static Object |
doGetField(Class inClass,
Object inObject,
String inName)
Access a given static field of a class. |
private static Object |
doInvokeMethod(Class inClass,
Object inObject,
String inName,
Object[] inArgs)
Invoke a given instance method. |
private static void |
doSetField(Class inClass,
Object inObject,
String inName,
Object inValue)
Modify a given field of an object or a class. |
private static Field |
findField(Class inClass,
String inName)
Find a given field of a class. |
private static Method |
findMethod(Class inClass,
String inName)
Find a given method of a class. |
static Object |
getField(Class inClass,
String inName)
Access a given static field of a class. |
static Object |
getField(Object inObject,
String inName)
Access a given field of an object. |
static Object |
invokeMethod(Class inClass,
String inName,
Object[] inArgs)
Invoke a given class method. |
static Object |
invokeMethod(Object inObject,
String inName,
Object[] inArgs)
Invoke a given instance method. |
static void |
setField(Class inClass,
String inName,
Object inValue)
Modify a given field of an object. |
static void |
setField(Object inObject,
String inName,
Object inValue)
Modify a given field of an object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
private PrivateAccessor()
| Method Detail |
|---|
public static Object getField(Class inClass,
String inName)
inClass - class we want the field of.inName - name of the field we want to access.
IllegalArgumentException - if a problem occurs.
public static Object getField(Object inObject,
String inName)
inObject - object we want the field of.inName - name of the field we want to access.
IllegalArgumentException - if a problem occurs.
private static Object doGetField(Class inClass,
Object inObject,
String inName)
inClass - class (of the object) we want the field of.inObject - object we want the field of or null if the
field is static.inName - name of the field we want to access.
IllegalArgumentException - if a problem occurs.
public static void setField(Class inClass,
String inName,
Object inValue)
inClass - class we want to modify the field of.inName - name of the field we want to access.inValue - new value for the field.
IllegalArgumentException - if a problem occurs.
public static void setField(Object inObject,
String inName,
Object inValue)
inObject - object we want to modify the field of.inName - name of the field we want to access.inValue - new value for the field.
IllegalArgumentException - if a problem occurs.
private static void doSetField(Class inClass,
Object inObject,
String inName,
Object inValue)
inClass - class (of the object) we want to modify the field of.inObject - object we want to modify the field of or
null if the field is static.inName - name of the field we want to access.inValue - new value for the field.
IllegalArgumentException - if a problem occurs.
public static Object invokeMethod(Class inClass,
String inName,
Object[] inArgs)
inClass - class we want to invoke a method of.inName - name of the method we want to invoke.inArgs - arguments for the invocation.
IllegalArgumentException - if a problem occurs.
public static Object invokeMethod(Object inObject,
String inName,
Object[] inArgs)
inObject - object we want to invoke the method of.inName - name of the method we want to invoke.inArgs - arguments for the invocation.
IllegalArgumentException - if a problem occurs.
private static Object doInvokeMethod(Class inClass,
Object inObject,
String inName,
Object[] inArgs)
inClass - class we want to invoke the method of.inObject - this for the method call, or
null if the method is static.inName - name of the method we want to invoke.inArgs - arguments for the invocation.
IllegalArgumentException - if a problem occurs.
private static Field findField(Class inClass,
String inName)
inClass - class we want the field of.inName - name of the field we want to access.
null if it couldn't
be found.
private static Method findMethod(Class inClass,
String inName)
inClass - class we want the method of.inName - name of the method we want to access.
null if it couldn't
be found.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||