java.lang.Object
de.haumacher.msgbuf.data.AbstractDataObject
- All Implemented Interfaces:
DataObject
- Direct Known Subclasses:
Command
Base class for
DataObject implementations.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidReads a JSON object containing keys for all fields of this object.protected voidreadField(JsonReader in, String field) Reads the given field from the given input.protected final voidreadFields(JsonReader in) Reads all fields of this instance from the given input.toString()final voidwriteContent(JsonWriter out) Writes a JSON object containing keys for all fields of this object.protected voidwriteFields(JsonWriter out) Writes all fields of this instance to the given output.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface de.haumacher.msgbuf.data.DataObject
writeTo
-
Constructor Details
-
AbstractDataObject
public AbstractDataObject()
-
-
Method Details
-
writeContent
Description copied from interface:DataObjectWrites a JSON object containing keys for all fields of this object.In contrast to
DataObject.writeTo(JsonWriter), the resulting object contains no type information. Therefore, this method must only be called directly, if the reader knows the type of the object to read from the context. For reading the data, a per-type generatedread[type-name]()method must be called.- Specified by:
writeContentin interfaceDataObject- Parameters:
out- The writer to write to.- Throws:
IOException
-
writeFields
Writes all fields of this instance to the given output.- Parameters:
out- The writer to write to.- Throws:
IOException- If writing fails.
-
readContent
Description copied from interface:DataObjectReads a JSON object containing keys for all fields of this object.This method does not consider type information contained in the stream.
- Specified by:
readContentin interfaceDataObject- Parameters:
in- The writer to write to.- Throws:
IOException
-
readFields
Reads all fields of this instance from the given input.- Parameters:
in- The reader to take the input from.- Throws:
IOException
-
readField
Reads the given field from the given input.- Parameters:
in- The reader to take the value from.field- The name of the field whose value should be read.- Throws:
IOException
-
toString
-