Class JsonLdSerializer
java.lang.Object
cz.cvut.kbss.jsonld.serialization.JsonLdSerializer
- All Implemented Interfaces:
Configured
- Direct Known Subclasses:
CompactedJsonLdSerializer,ContextBuildingJsonLdSerializer
Base class for all JSON-LD serializers.
The serializers will mostly differ in the form of the generated JSON. E.g. the output can be expanded, using contexts etc.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJsonLdSerializer(JsonGenerator jsonGenerator) JsonLdSerializer(JsonGenerator jsonGenerator, Configuration configuration) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract JsonNodebuildJsonTree(Object root) Builds the JSON-LD tree model.Gets the configuration holder for this JSON-LD processor.static JsonLdSerializercreateCompactedJsonLdSerializer(JsonGenerator jsonWriter) static JsonLdSerializercreateCompactedJsonLdSerializer(JsonGenerator jsonWriter, Configuration configuration) static JsonLdSerializercreateContextBuildingJsonLdSerializer(JsonGenerator jsonWriter) static JsonLdSerializercreateContextBuildingJsonLdSerializer(JsonGenerator jsonWriter, Configuration configuration) protected abstract ValueSerializers<T> voidregisterSerializer(Class<T> type, ValueSerializer<T> serializer) Registers a custom serializer for the specified type.voidSerializes object graph with the specified root.voidupdateConfiguration(Configuration configuration) Updates the configuration for this JSON-LD processor.
-
Field Details
-
jsonGenerator
-
serializers
-
-
Constructor Details
-
JsonLdSerializer
-
JsonLdSerializer
-
-
Method Details
-
configuration
Description copied from interface:ConfiguredGets the configuration holder for this JSON-LD processor.- Specified by:
configurationin interfaceConfigured- Returns:
- Configuration
-
updateConfiguration
Description copied from interface:ConfiguredUpdates the configuration for this JSON-LD processor.- Specified by:
updateConfigurationin interfaceConfigured- Parameters:
configuration- TheConfiguration.
-
registerSerializer
Registers a custom serializer for the specified type.If a serializer already existed for the type, it is replaced by the new one.
- Type Parameters:
T- Serialized type- Parameters:
type- Type to register the serializer forserializer- Serializer to register
-
serialize
Serializes object graph with the specified root.The serialization builds a JSON-LD tree model and then writes it using a
JsonGenerator, which was passed to this instance in constructor.- Parameters:
root- Object graph root
-
initSerializers
-
buildJsonTree
Builds the JSON-LD tree model.- Parameters:
root- Object graph root- Returns:
JsonNodecorresponding to the JSON-LD's tree root
-
createCompactedJsonLdSerializer
-
createCompactedJsonLdSerializer
public static JsonLdSerializer createCompactedJsonLdSerializer(JsonGenerator jsonWriter, Configuration configuration) -
createContextBuildingJsonLdSerializer
-
createContextBuildingJsonLdSerializer
public static JsonLdSerializer createContextBuildingJsonLdSerializer(JsonGenerator jsonWriter, Configuration configuration)
-