Class LiteralValueSerializers
java.lang.Object
cz.cvut.kbss.jsonld.serialization.serializer.LiteralValueSerializers
- All Implemented Interfaces:
Configurable
,ValueSerializers
Manages serializers of non-object property values for a single
JsonLdSerializer
instance.
That is, if an object is not referenced by an object property mapped attribute, it will be serialized by a serializer managed by this instance.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(Configuration configuration) Applies the specified configuration on this object.<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)
-
Constructor Details
-
LiteralValueSerializers
-
-
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
-
configure
Description copied from interface:Configurable
Applies the specified configuration on this object.- Specified by:
configure
in interfaceConfigurable
- Parameters:
configuration
- Configuration to apply
-