Class XmlIdRefSerializer<T>

java.lang.Object
io.micronaut.serde.support.serializers.XmlIdRefSerializer<T>
Type Parameters:
T - The value type
All Implemented Interfaces:
Serializer<T>

@Internal @Singleton public final class XmlIdRefSerializer<T> extends Object implements Serializer<T>
Serializes a JAXB @XmlIDREF value using its declared @XmlID.
Since:
3.2
  • Constructor Details

    • XmlIdRefSerializer

      public XmlIdRefSerializer()
      Creates an XML ID-reference serializer.
  • Method Details

    • createSpecific

      public Serializer<T> createSpecific(Serializer.EncoderContext context, io.micronaut.core.type.Argument<? extends T> type) throws SerdeException
      Description copied from interface: Serializer
      Create a more specific serializer for the given definition.
      Specified by:
      createSpecific in interface Serializer<T>
      Parameters:
      context - The encoder context
      type - The type definition including any annotation metadata
      Returns:
      The more specific serializer
      Throws:
      SerdeException
    • serialize

      public void serialize(Encoder encoder, Serializer.EncoderContext context, io.micronaut.core.type.Argument<? extends T> type, T value) throws IOException
      Description copied from interface: Serializer
      Serializes the given value using the passed Encoder.
      Specified by:
      serialize in interface Serializer<T>
      Parameters:
      encoder - The encoder to use
      context - The encoder context, never null
      type - Models the generic type of the value
      value - The value to serialize, never null. Callers should encode null values directly.
      Throws:
      IOException - If an error occurs during serialization