bluej.extensions.event
Class InvocationEvent

java.lang.Object
  extended by bluej.extensions.event.InvocationEvent
All Implemented Interfaces:
ExtensionEvent

public class InvocationEvent
extends java.lang.Object
implements ExtensionEvent

This class encapsulates events generated when the construction or invocation of a BlueJ object finishes. An invocation may finish in a normal way or it may be interrupted. From this event you can extract the actual result of the invocation, and access the BlueJ classes and objects involved.

Author:
Clive Miller, University of Kent at Canterbury, 2002, Damiano Bolla, University of Kent at Canterbury, 2003,2004

Field Summary
static int EXCEPTION_EXIT
          The execution finished due to an exception
static int FORCED_EXIT
          Deprecated. 
static int NORMAL_EXIT
          The execution finished normally.
static int TERMINATED_EXIT
          The execution finished because the user forcefully terminated it
static int UNKNOWN_EXIT
          This event is returned in case of unknown mapping
 
Constructor Summary
InvocationEvent(bluej.debugmgr.ExecutionEvent exevent)
          Constructor for the event.
 
Method Summary
 java.lang.String getClassName()
          Returns the class name on which this invocation took place.
 int getInvocationStatus()
          Returns the invocation status.
 java.lang.String getMethodName()
          Returns the method name being called.
 java.lang.String getObjectName()
          Returns the instance name of the invoked object on the object bench.
 BPackage getPackage()
          Returns the package in which this invocation took place.
 java.lang.String[] getParameters()
          Returns the values of the parameters to the invocation as strings.
 java.lang.Object getResult()
          Returns the newly created object (if any).
 java.lang.Class<?>[] getSignature()
          Returns the signature of the invoked method or constructor.
 java.lang.String toString()
          Returns a meaningful description of this Event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN_EXIT

public static final int UNKNOWN_EXIT
This event is returned in case of unknown mapping

See Also:
Constant Field Values

NORMAL_EXIT

public static final int NORMAL_EXIT
The execution finished normally.

See Also:
Constant Field Values

FORCED_EXIT

@Deprecated
public static final int FORCED_EXIT
Deprecated. 
The execution finished through a call to System.exit(). This is deprecated; it cannot actually occur.

See Also:
Constant Field Values

EXCEPTION_EXIT

public static final int EXCEPTION_EXIT
The execution finished due to an exception

See Also:
Constant Field Values

TERMINATED_EXIT

public static final int TERMINATED_EXIT
The execution finished because the user forcefully terminated it

See Also:
Constant Field Values
Constructor Detail

InvocationEvent

public InvocationEvent(bluej.debugmgr.ExecutionEvent exevent)
Constructor for the event.

Parameters:
exevent - Description of the Parameter
Method Detail

getInvocationStatus

public int getInvocationStatus()
Returns the invocation status. One of the values listed above.

Returns:
The invocationStatus value

getPackage

public BPackage getPackage()
Returns the package in which this invocation took place. Further information about the context of the event can be retrieved via the package object.

Returns:
The package value

getClassName

public java.lang.String getClassName()
Returns the class name on which this invocation took place. If you need further information about this class you can obtain a BClass from BPackage.getBClass() using this name as a reference.

Returns:
The className value

getObjectName

public java.lang.String getObjectName()
Returns the instance name of the invoked object on the object bench. If you need further information about this object you can obtain a BObject using BPackage.getObject() using this name as a reference. For a static method invocation, this method will return null. For a constructor call it will return the new instance name of the object on the object bench. For a method call it will return the name of the object on which the operation was invoked.

Returns:
The objectName value

getMethodName

public java.lang.String getMethodName()
Returns the method name being called. Returns null if this is an invocation of a constructor.

Returns:
The methodName value

getSignature

public java.lang.Class<?>[] getSignature()
Returns the signature of the invoked method or constructor. This is an array of Class objects representing the static types of the parameters to the method or constructor, in order. In the case of parameterised types, only the base type (e.g. List, not List) is returned.

Returns:
An array of Classes corresponding to the static types of the method's parameters.

getParameters

public java.lang.String[] getParameters()
Returns the values of the parameters to the invocation as strings. If a parameter really was a String, this will be returned either as the name of the string instance, or as a literal string enclosed in double quotes.

Returns:
The values of the parameters

getResult

public java.lang.Object getResult()
Returns the newly created object (if any). If the object is one that can be put on the object bench it will be an instance of BObject.

Returns:
an Object of various types or null if the result type is void.

toString

public java.lang.String toString()
Returns a meaningful description of this Event.

Overrides:
toString in class java.lang.Object
Returns:
Description of the Return Value


BlueJ homepage