|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.curjent.impl.agent.TypeInfo
final class TypeInfo
Information for bytecode generation of an agent's proxy and message classes. The purpose of the "info" classes, such as this one, is to simplify the bytecode generation process. The info classes gather and evaluate information needed to generate the proxy and message classes. This information is based on the agent's list of interfaces and its task type. The "factory" classes use this information to generate the bytecode and create the classes.
The diagram below shows the relationships between the info classes, the agent's interfaces, and the agent's task. For example, a single TypeInfo instance contains zero or more MethodInfo instances. Each MethodInfo instance describes exactly one interface method. And zero or more interface methods map to each task method.
MethodInfo
,
ProxyFactory
,
Agent.newInstance(AgentLoader, Class[], AgentTasks, Class)
Field Summary | |
---|---|
private static AtomicInteger |
id
Id generator to ensure uniquely named generated classes. |
(package private) String[] |
interfaceInternals
Internal JVM names for the agent's interfaces. |
(package private) Class<?>[] |
interfaces
Agent's interfaces. |
(package private) List<MethodInfo> |
methods
Information for each unique interface method. |
(package private) int |
proxyId
Unique id used to create uniquely named classes. |
(package private) String |
proxyInternal
Internal JVM name for the proxy class. |
(package private) String |
proxyName
Proxy's class name. |
(package private) String |
taskInternal
Internal JVM name for the task type. |
(package private) String |
taskName
Task type's name. |
(package private) Class<?> |
taskType
Task's class. |
Constructor Summary | |
---|---|
TypeInfo(Class<?>[] interfaces,
Class<?> taskType)
Evaluates and saves the information needed to generate the agent's proxy and message classes. |
Method Summary | |
---|---|
private Map<String,List<MethodInfo>> |
evaluateInterfaces()
Evaluates the agent's interfaces for unique methods. |
private void |
evaluateMethods()
Makes one final pass over the evaluated methods . |
private void |
evaluateTaskType(Map<String,List<MethodInfo>> map)
Evaluates the agent's task type given the information on the agent's interfaces. |
(package private) static String |
getInternalName(String name)
Converts a class name to an internal JVM name. |
(package private) static String[] |
getInternalNames(Class<?>[] types)
Converts an array of class names to their internal JVM names. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final AtomicInteger id
Class<?>[] interfaces
String[] interfaceInternals
java/lang/Runnable
for Runnable
.
Class<?> taskType
String taskName
Class.getName()
String taskInternal
int proxyId
id
String proxyName
taskName
,
proxyId
String proxyInternal
List<MethodInfo> methods
Constructor Detail |
---|
TypeInfo(Class<?>[] interfaces, Class<?> taskType)
AgentException
- The agent's interfaces and/or task type has an
illegal construct, such as incompatible return types, conflicting
annotations, etc.Method Detail |
---|
private Map<String,List<MethodInfo>> evaluateInterfaces()
Each unique interface method is evaluated with an instance of
MethodInfo
and added to methods
.
In addition, a map of method keys to MethodInfo
instances is
created and returned. The number of MethodInfo
instances is
equal to the number of unique interface methods, whereas the number of
keys may be less. See MethodInfo.getKey(Method)
for key
generation. See ResultInfo
for details on mapping interface
methods to task methods.
The keys in the returned map uniquely identify methods by name and parameters, excluding the return type. These keys correspond one-to-one to the task's methods and may number less than the number of interface methods. Associated with each key is a list of one or more unique interface methods (where uniqueness includes not only the interface method's name and parameters, but also its return type).
private void evaluateTaskType(Map<String,List<MethodInfo>> map)
evaluateInterfaces()
for details on the given
map
argument. This method updates the
MethodInfo
instances with information on the corresponding
task methods.
private void evaluateMethods()
methods
.
AgentException
- At least one interface method is missing a
corresponding task method.static String getInternalName(String name)
"java.lang.String"
to "java/lang/String"
.
static String[] getInternalNames(Class<?>[] types)
getInternalName(String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |