|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jage.test.ReflectionTestUtils
public class ReflectionTestUtils
ReflectionTestUtils is a collection of reflection-based utility methods for use in unit and integration testing
scenarios.
This class is actually just an facade to the Spring implementation, aiming to centralize and hide that coupling.
org.springframework.test.util.ReflectionTestUtils
Constructor Summary | |
---|---|
ReflectionTestUtils()
|
Method Summary | |
---|---|
static Object |
getField(Object target,
String name)
Get the field with the given name from the provided target object. |
static void |
setField(Object target,
String name,
Object value)
Set the field with the given name on the provided target object to the
supplied value . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReflectionTestUtils()
Method Detail |
---|
public static void setField(Object target, String name, Object value)
field
with the given name
on the provided target object
to the
supplied value
.
This method traverses the class hierarchy in search of the desired field. In addition, an attempt will be made to
make non-public
fields accessible, thus allowing one to set protected
,
private
, and package-private fields.
target
- the target object on which to set the fieldname
- the name of the field to setvalue
- the value to setorg.springframework.test.util.ReflectionTestUtils#setField(Object, String, Object)
public static Object getField(Object target, String name)
name
from the provided target object.
This method traverses the class hierarchy in search of the desired field. In addition, an attempt will be made to
make non-public
fields accessible, thus allowing one to get protected
,
private
, and package-private fields.
target
- the target object on which to set the fieldname
- the name of the field to get
org.springframework.test.util.ReflectionTestUtils#getField(Object, String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |