| java.lang.Object junitx.ddtunit.util.PrivilegedAccessor
PrivilegedAccessor | public class PrivilegedAccessor (Code) | | a.k.a. The "ObjectMolester"
This class is used to access a method or field of an object no matter what
the access modifier of the method or field. The syntax for accessing fields
and methods is out of the ordinary because this class uses reflection to peel
away protection.
Here is an example of using this to access a private member.
resolveName is a private method of Class .
Class c = Class.class;
System.out.println(PrivilegedAccessor.invokeMethod(c, "resolveName",
"/net/iss/common/PrivilegeAccessor"));
author: Charlie Hubbard (chubbard@iss.net) author: Prashant Dhokte (pdhokte@iss.net) |
|
|