Class TemporalSerializer
java.lang.Object
cz.cvut.kbss.jsonld.serialization.serializer.compact.datetime.TemporalSerializer
- All Implemented Interfaces:
Configurable
,ValueSerializer<TemporalAccessor>
- Direct Known Subclasses:
ContextBuildingTemporalSerializer
Serializes Java 8 date/time values represented by the
TemporalAccessor
interface.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
TemporalSerializer
(DateTimeSerializer dateTimeSerializer, LocalDateSerializer dateSerializer, TimeSerializer timeSerializer) -
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(Configuration config) Applies the specified configuration to this serializer.static List<Class<? extends TemporalAccessor>>
Gets the Java types supported by this serializer.serialize
(TemporalAccessor value, SerializationContext<TemporalAccessor> ctx) Serializes the specified value, returning a JSON-LD node representing it.
-
Field Details
-
dateTimeSerializer
-
-
Constructor Details
-
TemporalSerializer
public TemporalSerializer() -
TemporalSerializer
protected TemporalSerializer(DateTimeSerializer dateTimeSerializer, LocalDateSerializer dateSerializer, TimeSerializer timeSerializer)
-
-
Method Details
-
serialize
Description copied from interface:ValueSerializer
Serializes the specified value, returning a JSON-LD node representing it.Note that if the value is a singular, the returned node should also contain the identifier of the serialized attribute (available through the provided serialization context).
- Specified by:
serialize
in interfaceValueSerializer<TemporalAccessor>
- Parameters:
value
- Value to serializectx
- Serialization context- Returns:
- Serialization result
-
configure
Description copied from interface:ValueSerializer
Applies the specified configuration to this serializer.Should be called at the beginning of serialization of an object graph so that potential runtime changes in configuration can be reflected by the serialization process.
Implementations are free to apply configuration on initialization and rely on the default implementation of this method which does nothing.
- Specified by:
configure
in interfaceConfigurable
- Specified by:
configure
in interfaceValueSerializer<TemporalAccessor>
- Parameters:
config
- Configuration to apply
-
getSupportedTypes
Gets the Java types supported by this serializer.- Returns:
- List of Java classes
-