Class ObjectGraphValueSerializers
java.lang.Object
cz.cvut.kbss.jsonld.serialization.serializer.ObjectGraphValueSerializers
- All Implemented Interfaces:
Configurable
,ValueSerializers
Manager of value serializers aware of object graph traversal.
A new instance of this should be created every time a new object graph is being serialized.
-
Constructor Summary
ConstructorsConstructorDescriptionObjectGraphValueSerializers
(ValueSerializers serializers, ObjectPropertyValueSerializer opSerializer) -
Method Summary
Modifier and TypeMethodDescription<T> ValueSerializer<T>
getOrDefault
(SerializationContext<T> ctx) Gets a custom serializer registered for the specified serialization context or a default serializer if there is no custom one registered.<T> Optional<ValueSerializer<T>>
getSerializer
(SerializationContext<T> ctx) Gets a custom serializer for the specified serialization context.<T> boolean
hasCustomSerializer
(Class<T> type) Checks whether a custom serializer is registered for the specified type.void
registerIdentifierSerializer
(ValueSerializer<String> idSerializer) void
registerIndividualSerializer
(ValueSerializer<?> individualSerializer) <T> void
registerSerializer
(Class<T> forType, ValueSerializer<? super T> serializer) Registers the specified serializer for the specified type.void
registerTypesSerializer
(ValueSerializer<Set<String>> typesSerializer) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface cz.cvut.kbss.jsonld.common.Configurable
configure
-
Constructor Details
-
ObjectGraphValueSerializers
public ObjectGraphValueSerializers(ValueSerializers serializers, ObjectPropertyValueSerializer opSerializer)
-
-
Method Details
-
hasCustomSerializer
Description copied from interface:ValueSerializers
Checks whether a custom serializer is registered for the specified type.- Specified by:
hasCustomSerializer
in interfaceValueSerializers
- Type Parameters:
T
- Type of value- Parameters:
type
- Type to check for custom serializer for- Returns:
- Whether a custom serializer exists
-
getSerializer
Description copied from interface:ValueSerializers
Gets a custom serializer for the specified serialization context.- Specified by:
getSerializer
in interfaceValueSerializers
- Type Parameters:
T
- Type of the value- Parameters:
ctx
- Context representing the value to serialize- Returns:
- Optional containing the custom serializer registered for the specified value or an empty optional if there is no custom serializer registered
- See Also:
-
getOrDefault
Description copied from interface:ValueSerializers
Gets a custom serializer registered for the specified serialization context or a default serializer if there is no custom one registered.- Specified by:
getOrDefault
in interfaceValueSerializers
- Type Parameters:
T
- Type of the value- Parameters:
ctx
- Context representing the value to serialize- Returns:
- Value serializer for the specified context
- See Also:
-
registerSerializer
Description copied from interface:ValueSerializers
Registers the specified serializer for the specified type.- Specified by:
registerSerializer
in interfaceValueSerializers
- Type Parameters:
T
- Value type- Parameters:
forType
- Type to be serialized using the specified serializerserializer
- Serializer to register
-
getIdentifierSerializer
- Specified by:
getIdentifierSerializer
in interfaceValueSerializers
-
registerIdentifierSerializer
- Specified by:
registerIdentifierSerializer
in interfaceValueSerializers
-
getTypesSerializer
- Specified by:
getTypesSerializer
in interfaceValueSerializers
-
registerTypesSerializer
- Specified by:
registerTypesSerializer
in interfaceValueSerializers
-
getIndividualSerializer
- Specified by:
getIndividualSerializer
in interfaceValueSerializers
-
registerIndividualSerializer
- Specified by:
registerIndividualSerializer
in interfaceValueSerializers
-