alt.jiapi.event
Class FieldEventProducer

java.lang.Object
  extended by alt.jiapi.event.EventProducer
      extended by alt.jiapi.event.FieldEventProducer

public class FieldEventProducer
extends EventProducer

This class registers itself to Jiapi runtime and tracks field accesses. That is, gets and sets. When either event happens it will notify each listeners that has been registered.

Version:
$Revision: 1.13 $ $Date: 2010/03/05 10:34:45 $
Author:
Mika Riekkinen, Joni Suominen

Constructor Summary
FieldEventProducer(InstrumentationDescriptor id)
          Constructor.
FieldEventProducer(InstrumentationDescriptor id, java.lang.String resolution)
          Constructor.
 
Method Summary
 void addFieldListener(FieldListener fl)
          Adds a FieldListener.
 void fieldGet(java.lang.Object sourceObject, java.lang.String fieldName)
          This method is called by the Jiapi runtime.
 void fieldSet(java.lang.Object sourceObject, java.lang.String fieldName)
          This method is called by the Jiapi runtime.
protected  void fireFieldGetEvent(java.lang.Object sourceObject, java.lang.String fieldName)
          Fires an event when a field has been accessed(get).
protected  void fireFieldSetEvent(java.lang.Object sourceObject, java.lang.String fieldName)
          Fires an event when a field has been accessed(set).
 void removeFieldListener(FieldListener fl)
          Removes a FieldListener.
 
Methods inherited from class alt.jiapi.event.EventProducer
getResolutions, isProtected, isProtected, match, protect, release
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldEventProducer

public FieldEventProducer(InstrumentationDescriptor id)
Constructor. Resolution is set to '*', which indicates all field accesses are trapped.

Parameters:
id - Instrumentation decsriptor, that this FieldEventProducer registers itself to.

FieldEventProducer

public FieldEventProducer(InstrumentationDescriptor id,
                          java.lang.String resolution)
Constructor. Given resolution is compared to name of the field, and if it matches, a FieldEvent is produced.

Parameters:
id - Instrumentation decsriptor, that this FieldEventProducer registers itself to.
resolution - Resolution that is used in deciding whether or not an event should be produced.
Method Detail

addFieldListener

public void addFieldListener(FieldListener fl)
Adds a FieldListener.

Parameters:
fl - a FieldListener

fieldGet

public void fieldGet(java.lang.Object sourceObject,
                     java.lang.String fieldName)
This method is called by the Jiapi runtime. It should not be called by others.


fieldSet

public void fieldSet(java.lang.Object sourceObject,
                     java.lang.String fieldName)
This method is called by the Jiapi runtime. It should not be called by others.


fireFieldGetEvent

protected void fireFieldGetEvent(java.lang.Object sourceObject,
                                 java.lang.String fieldName)
Fires an event when a field has been accessed(get).

Parameters:
sourceObject -
fieldName - Name of the field

fireFieldSetEvent

protected void fireFieldSetEvent(java.lang.Object sourceObject,
                                 java.lang.String fieldName)
Fires an event when a field has been accessed(set).

Parameters:
sourceObject -
fieldName - Name of the field

removeFieldListener

public void removeFieldListener(FieldListener fl)
Removes a FieldListener.

Parameters:
fl - a FieldListener


Copyright © 2001. Documenation generated August 26 2011.