Interface ValueSerializers

All Superinterfaces:
Configurable
All Known Implementing Classes:
LiteralValueSerializers, ObjectGraphValueSerializers

public interface ValueSerializers extends Configurable
Provides serializers for JSON-LD tree building.
  • Method Details

    • hasCustomSerializer

      <T> boolean hasCustomSerializer(Class<T> type)
      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

      <T> Optional<ValueSerializer<T>> getSerializer(SerializationContext<T> ctx)
      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

      <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.
      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

      <T> void registerSerializer(Class<T> forType, ValueSerializer<? super T> serializer)
      Registers the specified serializer for the specified type.
      Type Parameters:
      T - Value type
      Parameters:
      forType - Type to be serialized using the specified serializer
      serializer - Serializer to register
    • getIdentifierSerializer

      ValueSerializer<String> getIdentifierSerializer()
    • registerIdentifierSerializer

      void registerIdentifierSerializer(ValueSerializer<String> idSerializer)
    • getTypesSerializer

      ValueSerializer<Set<String>> getTypesSerializer()
    • registerTypesSerializer

      void registerTypesSerializer(ValueSerializer<Set<String>> typesSerializer)
    • getIndividualSerializer

      ValueSerializer<?> getIndividualSerializer()
    • registerIndividualSerializer

      void registerIndividualSerializer(ValueSerializer<?> individualSerializer)