org.directwebremoting.event
Class MessageEvent

java.lang.Object
  extended by java.util.EventObject
      extended by org.directwebremoting.event.MessageEvent
All Implemented Interfaces:
java.io.Serializable

public class MessageEvent
extends java.util.EventObject

An MessageEvent is fired to a set of MessageListeners by the DWR Hub.

Author:
Joe Walker [joe at getahead dot ltd dot uk]
See Also:
Serialized Form

Constructor Summary
MessageEvent(Hub hub, ConverterManager converterManager, RawData rawData)
          Constructor for use with client-side originated messages
MessageEvent(Hub hub, java.lang.Object data)
          Constructor for use with server-side originated messages
 
Method Summary
<T> T
getData(java.lang.Class<T> asType)
          We convert the data (if the message is from the client) as late as possible so the message recipient can choose what type it should be.
 Hub getHub()
           
 java.lang.Object getRawData()
          WARNING: This method is for internal use only.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MessageEvent

public MessageEvent(Hub hub,
                    java.lang.Object data)
Constructor for use with server-side originated messages

Parameters:
hub - The hub used to send the data
data - The data to publish

MessageEvent

public MessageEvent(Hub hub,
                    ConverterManager converterManager,
                    RawData rawData)
Constructor for use with client-side originated messages

Parameters:
hub - The hub used to send the data
converterManager -
rawData -
Method Detail

getHub

public Hub getHub()
Returns:
the hub that processed this message
See Also:
EventObject.getSource()

getData

public <T> T getData(java.lang.Class<T> asType)
          throws MarshallException
We convert the data (if the message is from the client) as late as possible so the message recipient can choose what type it should be.

Type Parameters:
T - The type that we are converting to
Parameters:
asType - The type that we are converting to
Returns:
The data coerced into the required type
Throws:
MarshallException - If the data can not be coerced into required type

getRawData

public java.lang.Object getRawData()
WARNING: This method is for internal use only. It may well disappear at some stage in the future Sometimes we just want to get at whatever the data was originally without any conversion.

Returns:
The original data probably of type RawData

Copyright ¬ 2005