sunw.demo.encapsulatedEvents
Class EncapsulatedEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--sunw.demo.encapsulatedEvents.EncapsulatedEvent

public class EncapsulatedEvent
extends EventObject

The EncapsulatedEvent class is a subclass of java.util.EventObject and is designed as part of a package sun.demo.encapsulatedEvents to demonstrate the dynamic generation of JavaBeans Event Adaptor classes, and also a technique for creating a polymorphic event processing model as an extension of the existing JavaBeans Event Model.

See Also:
EncapsulatedEventAdaptor, EncapsulatedEventListener, EncapsulatedEventAdaptorGenerator, EncapsulatedEventException

Field Summary
protected  EventObject event
           
protected  java.lang.Object[] eventArgs
           
protected  java.lang.Class listenerInterface
           
protected  java.lang.reflect.Method listenerMethod
           
 
Constructor Summary
  EncapsulatedEvent(EventObject e, java.lang.reflect.Method m)
           Construct an Event Object from a simple event listener method.
  EncapsulatedEvent(java.lang.Object s, EventObject e, java.lang.reflect.Method m)
           Construct an Event Object from an intermediate.
protected EncapsulatedEvent(java.lang.Object s, EventObject e, java.lang.reflect.Method m, java.lang.Object[] a)
           Construct an EncapsulatedEvent object.
  EncapsulatedEvent(java.lang.Object s, java.lang.reflect.Method m, java.lang.Object[] a)
           Construct an Event Object from a cracked event listener method.
 
Method Summary
 void deliverEvent(EventListener el)
           This method can be used to deliver the encapsulated event to an object that conforms to the EventListener sub-interface that the event originated from.
 EventObject getEvent()
           
 java.lang.Object[] getEventArguments()
           
 java.lang.Class getEventClass()
           
 java.lang.String getEventClassName()
           
 java.lang.Object getEventSource()
           
 java.lang.Class getListenerInterface()
           
 java.lang.String getListenerInterfaceName()
           
 java.lang.reflect.Method getListenerMethod()
           
 java.lang.String getListenerMethodName()
           
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

event

protected EventObject event

listenerMethod

protected java.lang.reflect.Method listenerMethod

listenerInterface

protected java.lang.Class listenerInterface

eventArgs

protected java.lang.Object[] eventArgs
Constructor Detail

EncapsulatedEvent

protected EncapsulatedEvent(java.lang.Object s,
                            EventObject e,
                            java.lang.reflect.Method m,
                            java.lang.Object[] a)

Construct an EncapsulatedEvent object. An EncapsulatedEvent contains a reference to the "actual" event occurring, and the Method/Class from which this "actual" event was fired.

Parameters:
s - The "source" of the "actual" event (may not be null).
e - The "actual" event itself (or null if this is a "cracked" event.
m - The java.lang.reflect.Method describing the Listener method that this event was emitted from.

EncapsulatedEvent

public EncapsulatedEvent(java.lang.Object s,
                         EventObject e,
                         java.lang.reflect.Method m)

Construct an Event Object from an intermediate.


EncapsulatedEvent

public EncapsulatedEvent(EventObject e,
                         java.lang.reflect.Method m)

Construct an Event Object from a simple event listener method.


EncapsulatedEvent

public EncapsulatedEvent(java.lang.Object s,
                         java.lang.reflect.Method m,
                         java.lang.Object[] a)

Construct an Event Object from a cracked event listener method.

Method Detail

getEvent

public EventObject getEvent()
Returns:
The EventObject instance encapsulated or null if from a cracked event.

getEventClass

public java.lang.Class getEventClass()
Returns:
The java.lang.Class of the EventObject instance encapsulated or null if from a cracked event.

getEventClassName

public java.lang.String getEventClassName()
Returns:
The String name of the class of the EventObject instance encapsulated or null if from a cracked event.

getEventSource

public java.lang.Object getEventSource()
Returns:
The source object of the encapsulated EventObject instance.

getListenerMethod

public java.lang.reflect.Method getListenerMethod()
Returns:
the java.lang.reflect.Method of the EventListener Method.

getListenerMethodName

public java.lang.String getListenerMethodName()
Returns:
the name of the java.lang.reflect.Method of the EventListener Method.

getListenerInterface

public java.lang.Class getListenerInterface()
Returns:
the Class for the orginating EventListener subinterface

getListenerInterfaceName

public java.lang.String getListenerInterfaceName()
Returns:
the name of the Class for the orginating EventListener subinterface

getEventArguments

public java.lang.Object[] getEventArguments()
Returns:
an Object[] of the encapsulated event, if the EventObject is not already in the args, it is inserted by this class at index 0.

deliverEvent

public void deliverEvent(EventListener el)
                  throws java.lang.reflect.InvocationTargetException,
                         java.lang.IllegalAccessException

This method can be used to deliver the encapsulated event to an object that conforms to the EventListener sub-interface that the event originated from.

Parameters:
el - The EventListener object to deliver the unencapsulated event to.
Throws:
java.lang.reflect.InvocationTargetException -  
java.lang.IllegalAccessException -