edu.rit.m2mi
Class MethodInvoker

java.lang.Object
  extended by edu.rit.m2mi.MethodInvoker

public abstract class MethodInvoker
extends Object

Class MethodInvoker is the abstract base class for all synthesized method invoker classes in M2MI.

There are two levels in the method invoker class hierarchy:

A method invoker provides fields for storing the argument values. A method invoker provides a method for invoking the target method on a given target object, passing in the argument values from the method invoker's fields.

A method invoker is not itself serializable. However, a method invoker does provide methods to write its argument values to an object output stream and read its argument values from an object input stream.


Constructor Summary
MethodInvoker()
          Construct a new method invoker.
 
Method Summary
abstract  void invoke(Object theTargetObject)
          Perform the invocation specified by this method invoker on the given target object.
 void read(ObjectInput theObjectInput)
          Read this method invoker's argument values from the given object input stream.
 void write(ObjectOutput theObjectOutput)
          Write this method invoker's argument values to the given object output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodInvoker

public MethodInvoker()
Construct a new method invoker.

Method Detail

write

public void write(ObjectOutput theObjectOutput)
           throws IOException
Write this method invoker's argument values to the given object output stream.

The base class implementation does nothing. If the target method has one or more argument values, a subclass must override write() to write the argument values.

Parameters:
theObjectOutput - Object output stream to write to.
Throws:
IOException - Thrown if an I/O error occurred.

read

public void read(ObjectInput theObjectInput)
          throws IOException,
                 ClassNotFoundException
Read this method invoker's argument values from the given object input stream.

The base class implementation does nothing. If the target method has one or more argument values, a subclass must override read() to read the argument values.

Parameters:
theObjectInput - Object input stream to read from.
Throws:
IOException - Thrown if an I/O error occurred.
ClassNotFoundException - Thrown if the class could not be found for an object being read.

invoke

public abstract void invoke(Object theTargetObject)
Perform the invocation specified by this method invoker on the given target object. The target object's class must implement this method invoker's target interface. This method invoker's target method is invoked on the target object, passing in this method invoker's argument values.

A subclass must override invoke().

Parameters:
theTargetObject - Target object.
Throws:
NullPointerException - (unchecked exception) Thrown if theTargetObject is null.
ClassCastException - (unchecked exception) Thrown if theTargetObject is not an instance of this method invoker's target interface.


Copyright © 2001-2006 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.