|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.jemmy.ClassReference
public class ClassReference
Allows access to classes by reflection.
Constructor Summary | |
---|---|
ClassReference(Object o)
Constructor. |
|
ClassReference(String className)
Contructor. |
Method Summary | |
---|---|
Class[] |
getClasses()
Returns all superclasses. |
Object |
getField(String field_name)
Returns the field value. |
Object |
invokeMethod(String method_name,
Object[] params,
Class[] params_classes)
Locates method by name and parameter types and executes it. |
Object |
newInstance(Object[] params,
Class[] params_classes)
Locates constructor by parameter types and creates an instance. |
void |
setField(String field_name,
Object newValue)
Change a field's value. |
void |
startApplication()
Executes class's main(java.lang.String[]) method
with a zero-length java.lang.String array
as a parameter. |
void |
startApplication(String[] params)
Executes class's main(java.lang.String[]) method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassReference(Object o)
o
- Object to work with.public ClassReference(String className) throws ClassNotFoundException
className
- name of class
ClassNotFoundException
Method Detail |
---|
public void startApplication() throws InvocationTargetException, NoSuchMethodException
main(java.lang.String[])
method
with a zero-length java.lang.String
array
as a parameter.
NoSuchMethodException
InvocationTargetException
public void startApplication(String[] params) throws InvocationTargetException, NoSuchMethodException
main(java.lang.String[])
method.
params
- The java.lang.String
array to pass
to main(java.lang.String[])
.
NoSuchMethodException
InvocationTargetException
public Object invokeMethod(String method_name, Object[] params, Class[] params_classes) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException
method_name
- Name of method.params
- Method parameters.params_classes
- Method parameters types.
method_name
method is void, null
is returned.method_name
method returns a primitive type, then
return wrapper class instance.
InvocationTargetException
- when the invoked method throws an exception.
NoSuchMethodException
- when the method cannot be found.
IllegalAccessException
- when access to the class or method is lacking.
SecurityException
- if access to the package or method is denied.
IllegalAccessException
NoSuchMethodException
InvocationTargetException
public Object newInstance(Object[] params, Class[] params_classes) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException, InstantiationException
params
- An array of Method parameters.params_classes
- An array of Method parameter types.
InvocationTargetException
- when the invoked constructor throws an exception.
NoSuchMethodException
- when the constructor cannot be found.
IllegalAccessException
- when access to the class or constructor is lacking.
InstantiationException
- when the constructor is for an abstract class.
SecurityException
- if access to the package or constructor is denied.
IllegalAccessException
NoSuchMethodException
InstantiationException
InvocationTargetException
public Object getField(String field_name) throws NoSuchFieldException, IllegalAccessException
field_name
- The name of the field.
NoSuchFieldException
- when the field cannot be found.
IllegalAccessException
- when access to the class or constructor is lacking.
SecurityException
- if access to the package or field is denied.
IllegalAccessException
NoSuchFieldException
setField(java.lang.String, java.lang.Object)
public void setField(String field_name, Object newValue) throws NoSuchFieldException, IllegalAccessException
field_name
- The name of the field.newValue
- The fields new value.
NoSuchFieldException
- when the field cannot be found.
IllegalAccessException
- when access to the class or constructor is lacking.
SecurityException
- if access to the package or field is denied.
IllegalAccessException
NoSuchFieldException
getField(java.lang.String)
public Class[] getClasses()
java.lang.Object
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |