-
- All Known Subinterfaces:
ScopeMixin
- All Known Implementing Classes:
DefaultScope
public interface ScopeAPI for resolving cross-references in serialized object graphs.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidreadData(SharedGraphNode node, int id, JsonReader in)Reads object data of the given node and assigns the given ID to this node.SharedGraphNoderesolveOrFail(int id)Looks up the object with the given ID.voidwriteRefOrData(JsonWriter out, SharedGraphNode node)Writes the given graph node to the given writer.
-
-
-
Method Detail
-
resolveOrFail
SharedGraphNode resolveOrFail(int id)
Looks up the object with the given ID.- Parameters:
id- The ID of the requested object.- Returns:
- The object with the given ID.
- Throws:
IllegalArgumentException- If there is no object with the requested ID.
-
writeRefOrData
void writeRefOrData(JsonWriter out, SharedGraphNode node) throws IOException
Writes the given graph node to the given writer.If the node has already an ID in this scope, only the ID is transmitted as plain numeric value. Otherwise, a fresh ID is assigned to the node and the the full data of the given node is transmitted (by calling back to
SharedGraphNode.writeData(Scope, JsonWriter, int)).- Parameters:
out- TheJsonWriterto write to.node- The graph node to transmit.- Throws:
IOException
-
readData
void readData(SharedGraphNode node, int id, JsonReader in) throws IOException
Reads object data of the given node and assigns the given ID to this node.- Parameters:
node- The node to read data for.id- The ID to assign ot the given node.- Throws:
IOException
-
-