Package net.sf.eBus.messages
Class EReplyMessage
- java.lang.Object
-
- net.sf.eBus.messages.EMessageObject
-
- net.sf.eBus.messages.EMessage
-
- net.sf.eBus.messages.EReplyMessage
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
ApplicationInfoReply
,HistoricReply
,MonitoredObjectReply
,TimerReply
public class EReplyMessage extends EMessage implements java.io.Serializable
Required base class for all application request messages. Adds the message fields reply status, reply reason, and final reply flag.This message is not abstract because it is a complete message in its own right and may be used to send a generic reply to any request.
Note: messages are limited to 31 fields. This is due to eBus binary serialization format. This number is decreased to 27 fields for sub-classes because
EMessage
has two fields:subject
andtimestamp
andEReplyMessage
has two fields:replyStatus
andreplyReason
.- Author:
- Charles Rapp
- See Also:
ENotificationMessage
,ERequestMessage
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EReplyMessage.Builder<M extends EReplyMessage,B extends EReplyMessage.Builder<M,? extends EReplyMessage.Builder>>
Base class for allEReplyMessage
builders.static class
EReplyMessage.ConcreteBuilder
SinceEReplyMessage
is not abstract and may be instantiated as a concrete message, this builder is used to create anEReplyMessage
instance.static class
EReplyMessage.ReplyStatus
An eBus reply is limited to eitherOK
(success),OK_CONTINUING
(in-progress reply with more to come),CANCELED
(terminated before completion),CANCEL_REJECT
(cancel request rejected), andERROR
(failure to process request and request is terminated).-
Nested classes/interfaces inherited from class net.sf.eBus.messages.EMessage
EMessage.MessageType
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
replyReason
The reason for aEReplyMessage.ReplyStatus.ERROR
reply status.EReplyMessage.ReplyStatus
replyStatus
The current request handling status.-
Fields inherited from class net.sf.eBus.messages.EMessage
MAX_SUBJECT_LENGTH, subject, timestamp
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
EReplyMessage(EReplyMessage.Builder<?,?> builder)
Creates a new eBus reply message based on the given reply message builder.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EReplyMessage.Builder<?,?>
builder()
Returns theEReplyMessage
builder.boolean
equals(java.lang.Object o)
Returnstrue
ifo
is a non-null EReplyMessage
instance with a reply status and reply reason equal tothis EReplyMessage
instance andfalse
otherwise.int
hashCode()
Returns the reply message hash code.boolean
isFinal()
Returnstrue
if this is the final reply andfalse
if another reply is to be expected.java.lang.String
toString()
Returns the message subject, timestamp, and sequence number as a string.-
Methods inherited from class net.sf.eBus.messages.EMessage
isApplicationMessage, isSystemMessage, key, messageType, timestampAsInstant
-
-
-
-
Field Detail
-
replyStatus
@FieldDisplayIndex(index=0) public final EReplyMessage.ReplyStatus replyStatus
The current request handling status. IfEReplyMessage.ReplyStatus.ERROR
, thenreplyReason
will contain text explaining why the request was rejected.This field is displayed first.
-
replyReason
@FieldDisplayIndex(index=1) @Nullable public final java.lang.String replyReason
The reason for aEReplyMessage.ReplyStatus.ERROR
reply status. May benull
or empty.This field is displayed second.
-
-
Constructor Detail
-
EReplyMessage
protected EReplyMessage(EReplyMessage.Builder<?,?> builder)
Creates a new eBus reply message based on the given reply message builder.builder
is guaranteed to contain a valid message configuration at this point.- Parameters:
builder
- contains the reply message configuration.
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object o)
Returnstrue
ifo
is a non-null EReplyMessage
instance with a reply status and reply reason equal tothis EReplyMessage
instance andfalse
otherwise.
-
hashCode
public int hashCode()
Returns the reply message hash code.
-
toString
public java.lang.String toString()
Returns the message subject, timestamp, and sequence number as a string.
-
isFinal
public boolean isFinal()
Returnstrue
if this is the final reply andfalse
if another reply is to be expected.- Returns:
true
if this is the final reply.
-
builder
public static EReplyMessage.Builder<?,?> builder()
Returns theEReplyMessage
builder.- Returns:
EReplyMessage.Builder
instance.
-
-