1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

Convenience methods

This commit is contained in:
Andrew Gvozdev 2010-03-28 02:04:32 +00:00
parent 908de317bd
commit 196daf5a2a

View file

@ -33,6 +33,31 @@ public class Accessor extends Assert {
/** The instance to access. */
private Object fInstance;
/**
* Creates an accessor for the given <code>instance</code> and its
* <code>class</code>. Only non-inherited members that particular
* <code>class</code> can be accessed.
*
* @param instance the instance
*/
public Accessor(Object instance) {
assertNotNull(instance);
fInstance= instance;
fClass= instance.getClass();
}
/**
* Creates an accessor for the given <code>class</code>.
* Only static members of that particular <code>class</code> can be accessed.
*
* @param clazz the class
*/
public Accessor(Class<?> clazz) {
assertNotNull(clazz);
fInstance= null;
fClass= clazz;
}
/**
* Creates an accessor for the given <code>instance</code> and
* <code>class</code>. Only non-inherited members that particular
@ -145,6 +170,17 @@ public class Accessor extends Assert {
}
}
/**
* Invokes the method with the given method name and no arguments.
* <p>
*
* @param methodName the method name
* @return the method return value
*/
public Object invoke(String methodName) {
return invoke(methodName, null, new Object[0]);
}
/**
* Invokes the method with the given method name and arguments.
* <p>