public abstract class AbstractAdminMessage
extends java.lang.Object
AdminMessageFactory
.Modifier and Type | Field and Description |
---|---|
static byte |
CLASSIFIER_ADD_SUBSCRIPTION |
static byte |
CLASSIFIER_BOW_DOWN_TO_NEW_KING |
static byte |
CLASSIFIER_CENSUS_MESSAGE |
static byte |
CLASSIFIER_CLOSE_SERVER_CONNECTION |
static byte |
CLASSIFIER_DISCOVERED_DEVICE |
static byte |
CLASSIFIER_FINISHED_HANDSHAKE |
static byte |
CLASSIFIER_KEEP_ALIVE_MESSAGE |
static byte |
CLASSIFIER_NEW_PRINCE_MESSAGE |
static byte |
CLASSIFIER_PRINCE_ACK |
static byte |
CLASSIFIER_PRINCE_FOUND_A_KING_MESSAGE |
static byte |
CLASSIFIER_REMOVE_SUBSCRIPTION |
static byte |
CLASSIFIER_SERVER_CONNECTION_AVAILABLE |
static byte |
CLASSIFIER_SERVER_CONNECTION_DOWN |
static byte |
CLASSIFIER_SERVER_CONNECTION_RELAY_PAYLOAD |
static byte |
CLASSIFIER_STRING_MESSAGE |
protected static com.google.gson.Gson |
gson |
static int |
HEADER_LENGTH
The admin message header length in bytes.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractAdminMessage(BlaubotMessage message) |
|
AbstractAdminMessage(byte classifier) |
Modifier and Type | Method and Description |
---|---|
protected byte[] |
classifierAndPayloadBytes()
Get this message's byte representation including the classifier bytes
|
boolean |
equals(java.lang.Object obj) |
byte |
getClassifier() |
int |
hashCode() |
protected abstract byte[] |
payloadToBytes()
Gets this message's byte representation (NOT including the classifier)
|
protected void |
setClassifier(byte classifier) |
protected abstract void |
setUpFromBytes(java.nio.ByteBuffer messagePayloadAsBytes)
Should set the message's attributes based on the message's payload.
|
BlaubotMessage |
toBlaubotMessage()
Creates a
BlaubotMessage representing this AbstractAdminMessage |
public static int HEADER_LENGTH
protected static final com.google.gson.Gson gson
public static final byte CLASSIFIER_CENSUS_MESSAGE
public static final byte CLASSIFIER_NEW_PRINCE_MESSAGE
public static final byte CLASSIFIER_KEEP_ALIVE_MESSAGE
public static final byte CLASSIFIER_PRINCE_FOUND_A_KING_MESSAGE
public static final byte CLASSIFIER_BOW_DOWN_TO_NEW_KING
public static final byte CLASSIFIER_PRINCE_ACK
public static final byte CLASSIFIER_ADD_SUBSCRIPTION
public static final byte CLASSIFIER_REMOVE_SUBSCRIPTION
public static final byte CLASSIFIER_STRING_MESSAGE
public static final byte CLASSIFIER_SERVER_CONNECTION_AVAILABLE
public static final byte CLASSIFIER_SERVER_CONNECTION_DOWN
public static final byte CLASSIFIER_SERVER_CONNECTION_RELAY_PAYLOAD
public static final byte CLASSIFIER_CLOSE_SERVER_CONNECTION
public static final byte CLASSIFIER_DISCOVERED_DEVICE
public static final byte CLASSIFIER_FINISHED_HANDSHAKE
protected AbstractAdminMessage(BlaubotMessage message)
public AbstractAdminMessage(byte classifier)
protected void setClassifier(byte classifier)
public byte getClassifier()
protected abstract byte[] payloadToBytes()
protected byte[] classifierAndPayloadBytes()
protected abstract void setUpFromBytes(java.nio.ByteBuffer messagePayloadAsBytes)
ByteBuffer
contains the classifier bytes but it's current
index will be set beyond that.messagePayloadAsBytes
- a ByteBuffer wrapped around the message's payload with it's current index set beyond the classifier bytespublic BlaubotMessage toBlaubotMessage()
BlaubotMessage
representing this AbstractAdminMessage
BlaubotMessage
representationpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object