Class ReplyEvent
java.lang.Object
java.util.EventObject
cl.netswitch.lib.client.ReplyEvent
- All Implemented Interfaces:
Serializable
ReplyEvent is used to notify that a reply message has arrived.
- See Also:
-
Field Summary
Fields inherited from class EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionReplyEvent(ClientChannel channel, Message message) Constructs a newReplyEventinstance. -
Method Summary
Modifier and TypeMethodDescriptionReturns the client channel of this event.Returns the reply message of this event.<T extends Serializable>
TReturns the object contained in thesuccess messageof this ReplyEvent.Returns the reply message with aSUCCESSstatus.Methods inherited from class EventObject
getSource, toString
-
Constructor Details
-
ReplyEvent
Constructs a newReplyEventinstance.- Parameters:
channel- the object on which the event occurred.message- the reply message of this event.- Throws:
NullPointerException- if an argument isnull.
-
-
Method Details
-
getClientChannel
Returns the client channel of this event.- Returns:
- the client channel of this event.
-
getMessage
Returns the reply message of this event.- Returns:
- the reply message of this event.
-
getSuccessMessage
Returns the reply message with aSUCCESSstatus. It throws aClientExceptionif thestatusof the message is anERROR. TheClientExceptionincludes thestatus,textanduserMessageof the reply message.- Returns:
- the success reply message of this event.
- Throws:
ReplyTimeoutException- if the reply timeout.ClientException- if the reply message has an error status.
-
getObject
Returns the object contained in thesuccess messageof this ReplyEvent.Warning: to reduce memory consumption, this method returns a reference to (not a copy of) the mutable object stored in the reply message. If the returned object is later modified, the reply message object will be modified.
- Type Parameters:
T- the type of the returned object.- Parameters:
type- the class of the returned object.- Returns:
- a typed object or
nullif not defined. - Throws:
NullPointerException- iftypeisnull.ReplyTimeoutException- if the reply timeout.ClientException- if the reply message has an error status.ClassCastException- if object is not an instance oftype.- See Also:
-