Interface SharedGraphNode

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 Details

    • 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 the Scope. Otherwise, the complete object data is transmitted.

      Parameters:
      scope - The shared graph Scope that 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's Scope.writeRefOrData(JsonWriter, SharedGraphNode) if a fresh ID was assigned.

      Parameters:
      scope - The shared graph Scope that 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 graph Scope that 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 graph Scope that 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 graph Scope that 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 graph Scope that 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 graph Scope that 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