Package com.kristensoft.kdc
Class Reply
- java.lang.Object
-
- com.kristensoft.kdc.Agent
-
- com.kristensoft.kdc.Reply
-
- All Implemented Interfaces:
Serializable
public class Reply extends Agent implements Serializable
Represents a reply returned to the sender of anAgentduring synchronous or asynchronous communication.A reply contains a success indicator, an optional exception, a message, and an HTTP response code. It also indicates whether additional replies are expected.
Reply extends
Agent, allowing it to carry agent data and latency information.- Author:
- Charles B. Kozoyed
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Reply()Constructs a reply with default values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ThrowablegetException()Returns the exception associated with this reply.intgetHttpResponseCode()Returns the HTTP response code associated with this reply.StringgetMessage()Returns the message associated with this reply.booleanisLastReply()Indicates whether this is the final reply in the reply sequence.booleanisSuccess()Indicates whether the operation completed successfully.voidsetException(Throwable throwable)Sets the exception associated with this reply.voidsetHttpResponseCode(int httpResponseCode)Sets the HTTP response code associated with this reply.voidsetLastReply(boolean lastReply)Sets whether this is the final reply for the in the reply sequence.voidsetMessage(String message)Sets the message associated with this reply.voidsetSuccess(boolean success)Sets whether the operation completed successfully.-
Methods inherited from class com.kristensoft.kdc.Agent
duration, getAgentSerializer, getApiClassName, getApiMethodKey, getClient, getCreationTimeStamp, getData, getData, getLatencyRecord, getProtocol, getResponse, getShortUUID, getSizeInBytes, getStartTime, getStopTime, getUUID, getVisitorMethodName, hasData, hasData, isDispatchable, isSynchronous, setData, setData, setResponse, setUUID, setVisitMethod, setVisitMethod, toLogString, toString
-
-
-
-
Method Detail
-
setException
public final void setException(Throwable throwable)
Sets the exception associated with this reply.- Parameters:
throwable- the exception or other throwable, ornullif no exception is associated with the reply
-
setSuccess
public final void setSuccess(boolean success)
Sets whether the operation completed successfully.- Parameters:
success-trueif successful;falseotherwise
-
setMessage
public final void setMessage(String message)
Sets the message associated with this reply.- Parameters:
message- the non-null, non-blank message- Throws:
IllegalArgumentException- if the message is null or blank
-
getException
public final Throwable getException()
Returns the exception associated with this reply.- Returns:
- the exception or other throwable, or
nullif none was provided
-
isSuccess
public final boolean isSuccess()
Indicates whether the operation completed successfully.- Returns:
trueif successful;falseotherwise
-
isLastReply
public final boolean isLastReply()
Indicates whether this is the final reply in the reply sequence.- Returns:
trueif this is the last reply;falseotherwise
-
setLastReply
public void setLastReply(boolean lastReply)
Sets whether this is the final reply for the in the reply sequence.- Parameters:
lastReply-trueif this is the last reply;falseotherwise
-
getMessage
public final String getMessage()
Returns the message associated with this reply.- Returns:
- the reply message
-
getHttpResponseCode
public int getHttpResponseCode()
Returns the HTTP response code associated with this reply.KDC does not restrict this value to standard HTTP status codes.
- Returns:
- the HTTP response code
-
setHttpResponseCode
public void setHttpResponseCode(int httpResponseCode)
Sets the HTTP response code associated with this reply.KDC does not restrict this value to standard HTTP status codes.
- Parameters:
httpResponseCode- the HTTP response code
-
-