gov.nih.nci.caarray.services.fileparse2.arraydesign.test
Class TimeCalls
java.lang.Object
gov.nih.nci.caarray.services.fileparse2.arraydesign.test.TimeCalls
- Direct Known Subclasses:
- BCELCalls, JavassistCalls
public abstract class TimeCalls
- extends java.lang.Object
Program demonstrating how runtime class generation can be used to replace
reflection, with a substantial increase in performance for repeated calls.
This base class must be extended by subclasses that handle the actual runtime
code generation. Each subclass must also implement a main()
method that creates an instance of the subclass and then passes the command
line parameters to the base class run(java.lang.String, int)
method for running the actual
class generation and timing comparison code.
Nested Class Summary |
protected static class |
TimeCalls.DirectLoader
Simple-minded loader for constructed classes. |
Method Summary |
protected abstract byte[] |
createAccess(java.lang.Class tclas,
java.lang.reflect.Method gmeth,
java.lang.reflect.Method smeth,
java.lang.String cname)
Create access class for getting and setting a bean-style property value. |
void |
run(java.lang.String name,
int count)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
s_classLoader
protected TimeCalls.DirectLoader s_classLoader
- Class loader for access classes
TimeCalls
public TimeCalls()
createAccess
protected abstract byte[] createAccess(java.lang.Class tclas,
java.lang.reflect.Method gmeth,
java.lang.reflect.Method smeth,
java.lang.String cname)
throws java.lang.Exception
- Create access class for getting and setting a bean-style property value.
This creates a class that implements a get/set interface, with the actual
implementations of the get and set methods simply calling the supplied
target class methods, returning the bytecode array.
- Parameters:
tclas
- target class (may inherit get and set methods, or implement
directly)gmeth
- get method (must take nothing, return int
)smeth
- set method (must take int
, return void)cname
- name for constructed access class
- Returns:
- instance of class implementing the object interface
- Throws:
java.lang.Exception
- on error generating class
run
public void run(java.lang.String name,
int count)
throws java.lang.Exception
- Throws:
java.lang.Exception