Boeing Simulation 3.1 API Specification

util
Class MethodRequest

java.lang.Object
  |
  +--util.MethodRequest
All Implemented Interfaces:
Serializable

public final class MethodRequest
extends Object
implements Serializable

This class should be sent across to components as a way of requesting that a distributed component exectute a certain method. Permissions should be based off the getComponent method.

Version:
$Revision: 1.19 $
Author:
Dave Jurgens
See Also:
Serialized Form

Nested Class Summary
 class MethodRequest.UninvokableMethodException
          A class that is thrown if the MethodRequest that spawned it is trying to invoke a method that does not exist in the class in which it is attempted to be invoked.
 
Field Summary
private  List arguments
          The List containing in order the arguments to be passed in.
private  String methodName
          The name of the method that is to be remotely invoked.
private  int requestID
          This value is passed along to the Return value as a way of signifying which method it came from.
private  Class requesting
          The type of class requesting this method.
private static long serialVersionUID
           
 
Constructor Summary
MethodRequest(Class requesting, String methodName, List arguments)
           
MethodRequest(Class requesting, String method, Object[] arguments)
           
 
Method Summary
private  boolean argTypesMatch(Class[] args1, Class[] args2)
          Checks to see if all types Class objects from the second array are of the same type or extend the first array's class type at the index.
private static List arrayToList(Object[] args)
          Converts an array to a List.
private  String getArgTypes(Class[] argTypes)
          Returns a String containing the names of the class types in the array.
protected  Class[] getClassArray(Object[] args)
          Returns an array of the class types of the arguments.
protected  Method getMethod(Class c, String methodName, Class[] argTypes)
          This method gets the Method object for the types and name.
 String getMethodName()
          get the name of the method that is requested to execute.
 Class getRequestingType()
          get the type of object requesting the method execution.
 int getReturnValueID()
          This returns the unique integer that the ReturnValue generated by invoke will have.
 util.ReturnValue invoke(Object target)
          This method reflectively invokes the specified target.
 util.ReturnValue refuse()
          Return a ReturnValue consistent with this MethodRequest that reflects that this request has been denied.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

arguments

private final List arguments
The List containing in order the arguments to be passed in.


methodName

private final String methodName
The name of the method that is to be remotely invoked.


requestID

private final int requestID
This value is passed along to the Return value as a way of signifying which method it came from.


requesting

private final Class requesting
The type of class requesting this method.


serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

MethodRequest

public MethodRequest(Class requesting,
                     String methodName,
                     List arguments)

MethodRequest

public MethodRequest(Class requesting,
                     String method,
                     Object[] arguments)
Method Detail

getRequestingType

public Class getRequestingType()
get the type of object requesting the method execution.


getMethodName

public String getMethodName()
get the name of the method that is requested to execute.


getReturnValueID

public int getReturnValueID()
This returns the unique integer that the ReturnValue generated by invoke will have.


invoke

public util.ReturnValue invoke(Object target)
This method reflectively invokes the specified target. All Thowable values are caught and returned as the results of the reflective invoke. The request id is passed to the return value to provide an association between request and return value.


refuse

public util.ReturnValue refuse()
Return a ReturnValue consistent with this MethodRequest that reflects that this request has been denied.


toString

public String toString()
Overrides:
toString in class Object

getMethod

protected Method getMethod(Class c,
                           String methodName,
                           Class[] argTypes)
This method gets the Method object for the types and name. We need to iterate through all the types to allow for widening conversions of argument types. This is taken care of in the helper method argTypesMatch, which checks for this via the isAssignable from call.


argTypesMatch

private boolean argTypesMatch(Class[] args1,
                              Class[] args2)
Checks to see if all types Class objects from the second array are of the same type or extend the first array's class type at the index.


getArgTypes

private String getArgTypes(Class[] argTypes)
Returns a String containing the names of the class types in the array.


getClassArray

protected Class[] getClassArray(Object[] args)
Returns an array of the class types of the arguments.


arrayToList

private static List arrayToList(Object[] args)
Converts an array to a List.


Boeing Simulation 3.1 API Specification

To submit a bug or feature email the author of that class. Funding for this research was provided by Boeing and DARPA.