-
- All Superinterfaces:
Observable,ReflectiveDataObject
- All Known Implementing Classes:
AbstractSharedGraphNode
public interface SharedGraphNode extends Observable
Object in a shared graph.A shared graph is a collection of interconnected objects that exist on multiple host computers. All graphs are observed for modifications. Modifications on one host can be transmitted as patch to all other participants and applied there to keep the shared graph in sync.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ObjectreadElement(Scope scope, JsonReader in, String field)Read an element of the repeated field with the given name.voidreadField(Scope scope, JsonReader in, String field)Reads the given field from the given input.voidreadFields(Scope scope, JsonReader in)Reads all fields of this instance from the given input.voidwriteData(Scope scope, JsonWriter out, int id)Writes the complete data of this node including type and ID to the given writer.voidwriteElement(Scope scope, JsonWriter out, String field, Object element)Writes the given element value that is compatible with the repeated field with the given name to the given output.voidwriteFieldValue(Scope scope, JsonWriter out, String field)Writes a single value that is currently assigned to the field with the given name to the given writer.voidwriteTo(Scope scope, JsonWriter out)Writes this node to the given writer.-
Methods inherited from interface de.haumacher.msgbuf.observer.Observable
registerListener, unregisterListener
-
Methods inherited from interface de.haumacher.msgbuf.data.ReflectiveDataObject
get, jsonType, properties, set
-
-
-
-
Method Detail
-
writeTo
void writeTo(Scope scope, JsonWriter out) throws IOException
Writes this node to the given writer.Depending on the given
Scope, only a reference to this object is transmitted, if this node is already known by theScope. Otherwise, thecomplete objectdata is transmitted.- Parameters:
scope- The shared graphScopethat handles object references.out- The writer to write to.- Throws:
IOException
-
writeData
void writeData(Scope scope, JsonWriter out, int id) throws IOException
Writes the complete data of this node including type and ID to the given writer.Note: This method should only be called from a
Scope'sScope.writeRefOrData(JsonWriter, SharedGraphNode)if a fresh ID was assigned.- Parameters:
scope- The shared graphScopethat handles object references.out- The writer to write to.id- The ID to use for this node.- Throws:
IOException
-
readFields
void readFields(Scope scope, JsonReader in) throws IOException
Reads all fields of this instance from the given input.- Parameters:
scope- The shared graphScopethat handles object references.in- The reader to take the input from.- Throws:
IOException
-
writeFieldValue
void writeFieldValue(Scope scope, JsonWriter out, String field) throws IOException
Writes a single value that is currently assigned to the field with the given name to the given writer.- Parameters:
scope- The shared graphScopethat handles object references.out- The writer to write to.field- The name of the field whose value should be written.- Throws:
IOException
-
readField
void readField(Scope scope, JsonReader in, String field) throws IOException
Reads the given field from the given input.- Parameters:
scope- The shared graphScopethat handles object references.in- The reader to take the value from.field- The name of the field whose value should be read.- Throws:
IOException
-
writeElement
void writeElement(Scope scope, JsonWriter out, String field, Object element) throws IOException
Writes the given element value that is compatible with the repeated field with the given name to the given output.- Parameters:
scope- The shared graphScopethat handles object references.out- The writer to write to.field- The name of the field whose element should be written.element- The element value of the given field.- Throws:
IOException
-
readElement
Object readElement(Scope scope, JsonReader in, String field) throws IOException
Read an element of the repeated field with the given name.- Parameters:
scope- The shared graphScopethat handles object references.in- The reader to take the value from.field- The repeated field where an element value should be read for.- Returns:
- The read element value.
- Throws:
IOException
-
-