org.directwebremoting.event
Class DefaultMessageEvent

java.lang.Object
  extended by org.directwebremoting.event.DefaultMessageEvent
All Implemented Interfaces:
MessageEvent

public class DefaultMessageEvent
extends java.lang.Object
implements MessageEvent

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

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Constructor Summary
DefaultMessageEvent(Hub hub, ConverterManager converterManager, RealRawData rawData)
          Constructor for use with client-side originated messages
DefaultMessageEvent(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.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMessageEvent

public DefaultMessageEvent(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

DefaultMessageEvent

public DefaultMessageEvent(Hub hub,
                           ConverterManager converterManager,
                           RealRawData 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()
Specified by:
getHub in interface MessageEvent
Returns:
the hub that processed this message
See Also:
EventObject.getSource()

getData

public <T> T getData(java.lang.Class<T> asType)
Description copied from interface: MessageEvent
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.

Specified by:
getData in interface MessageEvent
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

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.

Specified by:
getRawData in interface MessageEvent
Returns:
The original data probably of type RawData

Copyright 2008