Interface InstanceVisitor
- All Known Implementing Classes:
JsonLdTreeBuilder
public interface InstanceVisitor
-
Method Summary
Modifier and TypeMethodDescriptionvoid
closeCollection
(SerializationContext<?> ctx) Called after the last collection item is processed.void
closeObject
(SerializationContext<?> ctx) Called when the graph traverser is done with traversing the current instance.void
openCollection
(SerializationContext<? extends Collection<?>> ctx) Called when a collection is encountered by the object traverser.void
openObject
(SerializationContext<?> ctx) Called when a new instance is discovered by the object graph traverser.void
visitAttribute
(SerializationContext<?> ctx) Called when an attribute is processed by the object graph traverser.void
Called when the identifier of an instance (JSON-LD@id
attribute) is encountered.void
visitIndividual
(SerializationContext<?> ctx) Visits an object that represents an individual, without any additional attributes.boolean
visitObject
(SerializationContext<?> ctx) Visits the instance represented by the specified context.void
visitTypes
(SerializationContext<Set<String>> ctx) Called when the types of an instance (JSON-LD@type
attribute) are serialized.
-
Method Details
-
visitIndividual
Visits an object that represents an individual, without any additional attributes. This can be an identifier-based attribute value (e.g., URI), or an enum constant mapped to an individual.- Parameters:
ctx
- Current serialization context
-
visitObject
Visits the instance represented by the specified context.Called before a new instance is open by the object graph traverser.
- Parameters:
ctx
- Current serialization context- Returns:
- Whether the object should be processed or not
- See Also:
-
openObject
Called when a new instance is discovered by the object graph traverser.The instance attributes will be processed immediately after this method returns.
- Parameters:
ctx
- Current serialization context
-
closeObject
Called when the graph traverser is done with traversing the current instance.- Parameters:
ctx
- Current serialization context- See Also:
-
visitAttribute
Called when an attribute is processed by the object graph traverser.Note that identifiers (
Id
) and types (Types
) are processed separately and are not visited as attributes. Also, when processingProperties
, this method is invoked for each property in the map.- Parameters:
ctx
- Current serialization context
-
visitIdentifier
Called when the identifier of an instance (JSON-LD@id
attribute) is encountered.This may be invoked out of order, at the beginning of processing an object.
- Parameters:
ctx
- Current serialization context
-
visitTypes
Called when the types of an instance (JSON-LD@type
attribute) are serialized.- Parameters:
ctx
- Current serialization context
-
openCollection
Called when a collection is encountered by the object traverser.This can be either when a top-level collection is discovered, or when an object's attribute is a collection.
- Parameters:
ctx
- Current serialization context
-
closeCollection
Called after the last collection item is processed.- Parameters:
ctx
- Current serialization context- See Also:
-