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> booleanhasCustomSerializer(Class<T> type) Checks whether a custom serializer is registered for the specified type.voidregisterIdentifierSerializer(ValueSerializer<String> idSerializer) voidregisterIndividualSerializer(ValueSerializer<?> individualSerializer) <T> voidregisterSerializer(Class<T> forType, ValueSerializer<? super T> serializer) Registers the specified serializer for the specified type.voidregisterTypesSerializer(ValueSerializer<Set<String>> typesSerializer) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:ValueSerializersChecks whether a custom serializer is registered for the specified type.- Specified by:
hasCustomSerializerin 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:ValueSerializersGets a custom serializer for the specified serialization context.- Specified by:
getSerializerin 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:ValueSerializersGets a custom serializer registered for the specified serialization context or a default serializer if there is no custom one registered.- Specified by:
getOrDefaultin 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:ValueSerializersRegisters the specified serializer for the specified type.- Specified by:
registerSerializerin interfaceValueSerializers- Type Parameters:
T- Value type- Parameters:
forType- Type to be serialized using the specified serializerserializer- Serializer to register
-
getIdentifierSerializer
- Specified by:
getIdentifierSerializerin interfaceValueSerializers
-
registerIdentifierSerializer
- Specified by:
registerIdentifierSerializerin interfaceValueSerializers
-
getTypesSerializer
- Specified by:
getTypesSerializerin interfaceValueSerializers
-
registerTypesSerializer
- Specified by:
registerTypesSerializerin interfaceValueSerializers
-
getIndividualSerializer
- Specified by:
getIndividualSerializerin interfaceValueSerializers
-
registerIndividualSerializer
- Specified by:
registerIndividualSerializerin interfaceValueSerializers
-