public abstract class Message extends Object
Subclasses provide serialization (through toJson(java.io.Writer)
and
de-serialization (through the constructor) of JSON messages. Each instance of
the message is immutable.
Modifier and Type | Class and Description |
---|---|
static class |
Message.MessageType
The type of message.
|
Modifier and Type | Method and Description |
---|---|
int |
getId()
The id of the channel this message refers to.
|
Message.MessageType |
getMessage()
The message type.
|
static Object |
readValueFromJson(javax.json.JsonValue msgValue)
Converts the given JSON value to either a vtype, a Java time or a
ListNumber.
|
void |
toJson(Writer writer)
Serializes this message as JSON onto the given writer.
|
static void |
writeValueToJson(javax.json.stream.JsonGenerator gen,
String name,
Object value)
Converts the given value to a JSON representation.
|
public Message.MessageType getMessage()
public int getId()
public void toJson(Writer writer)
writer
- the destination where to serialize the messagepublic static Object readValueFromJson(javax.json.JsonValue msgValue)
msgValue
- the JSON valuepublic static void writeValueToJson(javax.json.stream.JsonGenerator gen, String name, Object value)
gen
- the object to create/store the JSON representationname
- the JSON name to store the value asvalue
- the value to storeCopyright © 2015. All rights reserved.