alt.jiapi.event
Class JiapiEvent

java.lang.Object
  extended by java.util.EventObject
      extended by alt.jiapi.event.JiapiEvent
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ExceptionEvent, FieldEvent, MethodEvent

public class JiapiEvent
extends java.util.EventObject

Base class for Jiapi events. This method is safe, in terms of event loop protection. That is, calling methods of JiapiEvent is guaranteed not to produce any further events from occuring.

Version:
$Revision: 1.7 $ $Date: 2002/03/26 08:16:13 $
Author:
Mika Riekkinen, Joni Suominen
See Also:
Serialized Form

Field Summary
protected  int id
           
protected  java.lang.Object sourceObject
           
protected  java.lang.Object target
           
protected  java.lang.String targetName
           
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
JiapiEvent(EventProducer ep, java.lang.Object sourceObject, java.lang.String targetName, int id)
          Constructor for JiapiEvent.
JiapiEvent(EventProducer ep, java.lang.Object sourceObject, java.lang.String targetName, java.lang.Object target, int id)
          Constructor for JiapiEvent.
 
Method Summary
 void finalize()
          Finalization releases possible locks made on EventProducer.
 java.lang.Object getSourceObject()
          Get the source Object.
 java.lang.Object getTarget()
          Gets target Object.
 java.lang.String getTargetName()
          Gets the name associated with this event.
 void protect()
          This method protects application from entering into recursive event loop.
 void release()
          This method releases EventProducer so, that it is able to produce more events for the sourceObject.
 java.lang.String toString()
           
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected int id

sourceObject

protected java.lang.Object sourceObject

target

protected java.lang.Object target

targetName

protected java.lang.String targetName
Constructor Detail

JiapiEvent

public JiapiEvent(EventProducer ep,
                  java.lang.Object sourceObject,
                  java.lang.String targetName,
                  int id)
Constructor for JiapiEvent. Target is set to null.

Parameters:
ep - EventProducer
sourceObject - Source Object.
targetName - name of the target Object
id - Id of the event

JiapiEvent

public JiapiEvent(EventProducer ep,
                  java.lang.Object sourceObject,
                  java.lang.String targetName,
                  java.lang.Object target,
                  int id)
Constructor for JiapiEvent.

Parameters:
ep - EventProducer. This is passed to parent class with super(ep);
sourceObject - Source Object.
targetName - name of the target Object
target - target Object
id - Id of the event
Method Detail

finalize

public void finalize()
Finalization releases possible locks made on EventProducer.

Overrides:
finalize in class java.lang.Object

getSourceObject

public java.lang.Object getSourceObject()
Get the source Object.

Returns:
source Object

getTarget

public java.lang.Object getTarget()
Gets target Object.

Returns:
target Object or null, if target is not specified.

getTargetName

public java.lang.String getTargetName()
Gets the name associated with this event. For example, MethodEvent provides name of the method and FieldEvent provides name of the field.

Returns:
name of the target

protect

public void protect()
This method protects application from entering into recursive event loop. This situation may occur, if a method has been instrumented, and instrumentation produces an event. If that method is called, directly or indirectly, with the aid of JiapiEvent, application will enter to an endless event loop, eventually crashing Virtual Machine.

Calling this method prevents EventProducer from producing further events for the same sourceObject. This protection mechanism allows applications to call methods of sourceObject and targetObject without worrying about event loops.

To enable events again, one will have to release EventProducer with method release.

See Also:
EventProducer.protect(JiapiEvent), release()

release

public void release()
This method releases EventProducer so, that it is able to produce more events for the sourceObject.

See Also:
EventProducer.release(JiapiEvent), protect()

toString

public java.lang.String toString()
Overrides:
toString in class java.util.EventObject


Copyright © 2001. Documenation generated August 26 2011.