Interface ValueSerializers
- All Superinterfaces:
Configurable
- All Known Implementing Classes:
LiteralValueSerializers
,ObjectGraphValueSerializers
Provides serializers for JSON-LD tree building.
-
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 interface cz.cvut.kbss.jsonld.common.Configurable
configure
-
Method Details
-
hasCustomSerializer
Checks whether a custom serializer is registered for the specified type.- Type Parameters:
T
- Type of value- Parameters:
type
- Type to check for custom serializer for- Returns:
- Whether a custom serializer exists
-
getSerializer
Gets a custom serializer for the specified serialization context.- 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
Gets a custom serializer registered for the specified serialization context or a default serializer if there is no custom one registered.- 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
Registers the specified serializer for the specified type.- Type Parameters:
T
- Value type- Parameters:
forType
- Type to be serialized using the specified serializerserializer
- Serializer to register
-
getIdentifierSerializer
ValueSerializer<String> getIdentifierSerializer() -
registerIdentifierSerializer
-
getTypesSerializer
ValueSerializer<Set<String>> getTypesSerializer() -
registerTypesSerializer
-
getIndividualSerializer
ValueSerializer<?> getIndividualSerializer() -
registerIndividualSerializer
-