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 java.util.EventObject
source
-
Constructor Summary
ConstructorDescriptionReplyEvent
(ClientChannel channel, Message message) Constructs a newReplyEvent
instance. -
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 message
of this ReplyEvent.Returns the reply message with aSUCCESS
status.Methods inherited from class java.util.EventObject
getSource, toString
-
Constructor Details
-
ReplyEvent
Constructs a newReplyEvent
instance.- 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 aSUCCESS
status. It throws aClientException
if thestatus
of the message is anERROR
. TheClientException
includes thestatus
,text
anduserMessage
of 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 message
of 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
null
if not defined. - Throws:
NullPointerException
- iftype
isnull
.ReplyTimeoutException
- if the reply timeout.ClientException
- if the reply message has an error status.ClassCastException
- if object is not an instance oftype
.- See Also:
-