|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.curjent.impl.agent.ResultInfo
final class ResultInfo
Information for bytecode generation of method results. For non-void method
return types, a field is generated in each method's message for the method's
result. This class contains bytecode information for transferring results to
and from the message, including information specific to agent methods
returning Future
values. It also contains information on
execution of the method, such as whether or not it runs synchronously. The
execution model is intimately tied to method return types.
The JVM specifies that an interface method is uniquely identified by its
name, parameters, and return type. A task method, in contrast, is uniquely
identified by only its name and parameters. Consequently, all interface
methods with same name and parameters map to exactly one task method that has
a matching name and parameters. For this reason, as well as for agent methods
returning Future
results, this class provides information for
the interface's return type, the task's return type, and the message field
type for the result if any. Another consequence of this many-to-one
relationship between interface and task methods is that there is exactly one
ResultInfo
instance for each unique interface method, but
potentially multiple instances associated with each task method.
The following naming convention is used for this class's fields: field names
prefixed with type
provide information on the interface's
method; field names prefixed with task
provide information on
the corresponding task's method; and field names prefixed with
message
provide information on the corresponding message and its
field, if any, for the task method's result.
ParamInfo
,
MethodInfo
,
TypeInfo
Field Summary | |
---|---|
(package private) BoxedInfo |
messageBoxed
Primitive value boxing and unboxing information for the message field's type. |
(package private) boolean |
messageCall
true if messageFuture is true and
the interface method's return type is AgentCall . |
(package private) String |
messageDescriptor
Message field type descriptor. |
(package private) boolean |
messageFuture
true if the agent call is asynchronous and returns a future
value. |
(package private) String |
messageInternal
Message field internal name. |
(package private) boolean |
messageResult
true if the task method's return type is not
void . |
(package private) boolean |
messageSynchronous
true if the agent call is synchronous. |
(package private) Class<?> |
messageType
Message field type for holding the return value. |
(package private) boolean |
taskFuture
true if the task method's return type is a subclass of
Future . |
(package private) Method |
taskMethod
The task's method. |
(package private) boolean |
taskResult
true if the task method's return type is not
void . |
(package private) int |
taskSize
Stack size of the return value. |
(package private) boolean |
taskSynchronous
true if the task method is annotated as
Synchronous . |
(package private) Class<?> |
taskType
Task method's return type. |
(package private) boolean |
typeCall
true if the interface method's return type is
AgentCall . |
(package private) boolean |
typeFuture
true if the interface method's return type is
Future or AgentCall . |
(package private) Method |
typeMethod
The interface's method. |
(package private) Class<?> |
typeType
Interface method's return type. |
(package private) boolean |
typeVoid
true if the interface method's return type is
void . |
Constructor Summary | |
---|---|
ResultInfo(Method typeMethod)
Initializes the interface method's return type fields (i.e., the fields of this class whose names begin with type ) with information
from the given interface method. |
Method Summary | |
---|---|
(package private) boolean |
isCompatibleType(ResultInfo other)
Returns true if two interface methods' return types are
compatible. |
(package private) boolean |
isSameType(ResultInfo other)
Returns true if two interface method's return types are
the same class. |
(package private) void |
setTaskResult(Method taskMethod)
Initializes the task method's return type fields (i.e., the fields of this class whose names begin with task ) with information
from the given task method, and evaluates the interface and task method
information to derive the message field information (i.e., the fields of
this class whose names begin with message ). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
Method typeMethod
Class<?> typeType
boolean typeVoid
true
if the interface method's return type is
void
.
boolean typeFuture
true
if the interface method's return type is
Future
or AgentCall
.
boolean typeCall
true
if the interface method's return type is
AgentCall
.
Method taskMethod
Class<?> taskType
boolean taskResult
true
if the task method's return type is not
void
.
boolean taskFuture
true
if the task method's return type is a subclass of
Future
.
boolean taskSynchronous
true
if the task method is annotated as
Synchronous
.
int taskSize
0
for
void
, 2
for long
or
double
, or 1
for all others.
boolean messageFuture
true
if the agent call is asynchronous and returns a future
value. This implies the interface method's return type is
Future
or AgentCall
, and the task's method is
not annotated with Synchronous
. If the task's method is
annotated with Synchronous
, the agent call synchronously
returns a Future
or AgentCall
object.
boolean messageCall
true
if messageFuture
is true
and
the interface method's return type is AgentCall
.
boolean messageSynchronous
true
if the agent call is synchronous. Cannot be
true
if messageFuture
is true
. A
synchronous call implies the task's method is annotated with
Synchronous
, or the interface method's return type is not
void
nor Future
or AgentCall
.
Class<?> messageType
Future
. In this
case, the return value saved in the message is the value returned from
the task result's get()
method. This value is always of type
Object.class
.
boolean messageResult
true
if the task method's return type is not
void
. Always the same as taskResult
;
duplicated here to make the bytecode generators easier to read.
String messageInternal
"java/lang/String"
for String
.
String messageDescriptor
"Ljava/lang/String;"
for String
.
BoxedInfo messageBoxed
null
for non-primitive types.
Constructor Detail |
---|
ResultInfo(Method typeMethod)
type
) with information
from the given interface method.
Method Detail |
---|
void setTaskResult(Method taskMethod)
task
) with information
from the given task method, and evaluates the interface and task method
information to derive the message field information (i.e., the fields of
this class whose names begin with message
).
AgentException
- Task return type is not assignment compatible with
its interface return type. Does not apply to asynchronous calls with
future results.boolean isSameType(ResultInfo other)
true
if two interface method's return types are
the same class.
boolean isCompatibleType(ResultInfo other)
true
if two interface methods' return types are
compatible. The return types are compatible if either is assignment
compatible with the other (which implies that both are at least
potentially assignment compatible with the task method's return type).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |