Class JsonLdTreeBuilder
java.lang.Object
cz.cvut.kbss.jsonld.serialization.JsonLdTreeBuilder
- All Implemented Interfaces:
InstanceVisitor
Builds an abstract representation of a JSON-LD tree, which is a result of object graph traversal by
ObjectGraphTraverser
.-
Constructor Summary
ConstructorsConstructorDescriptionJsonLdTreeBuilder
(ValueSerializers serializers, JsonLdContextFactory jsonLdContextFactory) -
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>> typesCtx) Called when the types of an instance (JSON-LD@type
attribute) are serialized.
-
Constructor Details
-
JsonLdTreeBuilder
-
-
Method Details
-
visitIndividual
Description copied from interface:InstanceVisitor
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.- Specified by:
visitIndividual
in interfaceInstanceVisitor
- Parameters:
ctx
- Current serialization context
-
visitObject
Description copied from interface:InstanceVisitor
Visits the instance represented by the specified context.Called before a new instance is open by the object graph traverser.
- Specified by:
visitObject
in interfaceInstanceVisitor
- Parameters:
ctx
- Current serialization context- Returns:
- Whether the object should be processed or not
- See Also:
-
openObject
Description copied from interface:InstanceVisitor
Called when a new instance is discovered by the object graph traverser.The instance attributes will be processed immediately after this method returns.
- Specified by:
openObject
in interfaceInstanceVisitor
- Parameters:
ctx
- Current serialization context
-
closeObject
Description copied from interface:InstanceVisitor
Called when the graph traverser is done with traversing the current instance.- Specified by:
closeObject
in interfaceInstanceVisitor
- Parameters:
ctx
- Current serialization context- See Also:
-
visitIdentifier
Description copied from interface:InstanceVisitor
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.
- Specified by:
visitIdentifier
in interfaceInstanceVisitor
- Parameters:
idCtx
- Current serialization context
-
visitTypes
Description copied from interface:InstanceVisitor
Called when the types of an instance (JSON-LD@type
attribute) are serialized.- Specified by:
visitTypes
in interfaceInstanceVisitor
- Parameters:
typesCtx
- Current serialization context
-
visitAttribute
Description copied from interface:InstanceVisitor
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.- Specified by:
visitAttribute
in interfaceInstanceVisitor
- Parameters:
ctx
- Current serialization context
-
openCollection
Description copied from interface:InstanceVisitor
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.
- Specified by:
openCollection
in interfaceInstanceVisitor
- Parameters:
ctx
- Current serialization context
-
closeCollection
Description copied from interface:InstanceVisitor
Called after the last collection item is processed.- Specified by:
closeCollection
in interfaceInstanceVisitor
- Parameters:
ctx
- Current serialization context- See Also:
-
getTreeRoot
-