Class ClientAnswer
java.lang.Object
ch.autumo.beetroot.server.message.AbstractMessage
ch.autumo.beetroot.server.message.ClientAnswer
- Direct Known Subclasses:
FileAnswer,HealthAnswer,StopAnswer
Client answer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intFields inherited from class ch.autumo.beetroot.server.message.AbstractMessage
domain, ENCRYPT, entity, fileId, id, INTERNAL_MSG_PART_SEPARATOR, INTERNAL_MSG_PART_SEPARATOR_REGEXP, LOG, message, MSG_PART_SEPARATOR, MSG_PART_SEPARATOR_REGEXP, object, serverName -
Constructor Summary
ConstructorsConstructorDescriptionClient answer.ClientAnswer(int type) Client answer.ClientAnswer(int type, String answer, String entity, long id, String errorReason) Client answer.ClientAnswer(String answer) Client answer.ClientAnswer(String answer, int type) Client answer.ClientAnswer(String answer, String fileId) Client answer.ClientAnswer(String answer, String entity, long id) Client answer. -
Method Summary
Modifier and TypeMethodDescriptionGet answer, possibly holds message parts separated by '|'.Get error reason if any.Get JSON representation; this includes all set information including the additional object if set.Get transfer string; this includes all set information including the additional object is set.intgetType()Get client answer type.static ClientAnswerCreate a new client answer out of transfer string.static ClientAnswerCreate a new client answer out of JSON transfer string.Methods inherited from class ch.autumo.beetroot.server.message.AbstractMessage
contains, deserializeObject, getData, getDataLength, getDomain, getEntity, getFileId, getId, getJSONObject, getMessageIntValue, getMessageValue, getObject, serializeObject, setEntity, setObject
-
Field Details
-
TYPE_OK
public static final int TYPE_OK- See Also:
-
TYPE_FILE_OK
public static final int TYPE_FILE_OK- See Also:
-
TYPE_FILE_NOK
public static final int TYPE_FILE_NOK- See Also:
-
TYPE_ERROR
public static final int TYPE_ERROR- See Also:
-
-
Constructor Details
-
ClientAnswer
public ClientAnswer()Client answer. -
ClientAnswer
public ClientAnswer(int type) Client answer.- Parameters:
type- type
-
ClientAnswer
Client answer. The answer can have parts, separated by '|'.- Parameters:
answer- answer
-
ClientAnswer
Client answer. The answer can have parts, separated by '|'.- Parameters:
answer- answertype- type
-
ClientAnswer
Client answer. The answer can have parts, separated by '|'.- Parameters:
answer- answerfileId- file ID of uploaded file generated by a file server
-
ClientAnswer
Client answer. The answer can have parts, separated by '|'.- Parameters:
answer- answerentity- entity name of served/looked-up entityid- id name of served/looked-up entity
-
ClientAnswer
Client answer. The answer can have parts, separated by '|'.- Parameters:
type- typeanswer- answerentity- entity name of served/looked-up entityid- id name of served/looked-up entityerrorReason- if there's an error
-
-
Method Details
-
getType
public int getType()Get client answer type.- Returns:
- type
-
getAnswer
Get answer, possibly holds message parts separated by '|'.- Returns:
- answer
-
getErrorReason
Get error reason if any.- Returns:
- error reason
-
getTransferString
Description copied from class:AbstractMessageGet transfer string; this includes all set information including the additional object is set.- Specified by:
getTransferStringin classAbstractMessage- Returns:
- transfer string
- Throws:
IOException- IO exception
-
parse
Create a new client answer out of transfer string.- Parameters:
transferString- transfer string- Returns:
- parsed client answer command
- Throws:
IOException- IO exception
-
getJsonTransferString
Description copied from class:AbstractMessageGet JSON representation; this includes all set information including the additional object if set.- Specified by:
getJsonTransferStringin classAbstractMessage- Returns:
- transfer JSON string
- Throws:
IOException- IO exception
-
parseJson
Create a new client answer out of JSON transfer string.- Parameters:
transferString- JSON transfer string- Returns:
- parsed client answer
- Throws:
IOException- IO exception
-