Class Jaxb2XmlEncoder

java.lang.Object
org.springframework.core.codec.AbstractEncoder<T>
org.springframework.core.codec.AbstractSingleValueEncoder<Object>
org.springframework.http.codec.xml.Jaxb2XmlEncoder
All Implemented Interfaces:
org.springframework.core.codec.Encoder<Object>

public class Jaxb2XmlEncoder extends org.springframework.core.codec.AbstractSingleValueEncoder<Object>
Encode from single value to a byte stream containing XML elements.

@XmlElements and @XmlElement can be used to specify how collections should be marshalled.

Since:
5.0
Author:
Sebastien Deleuze, Arjen Poutsma
See Also:
  • Field Summary

    Fields inherited from class org.springframework.core.codec.AbstractEncoder

    logger
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canEncode(org.springframework.core.ResolvableType elementType, org.springframework.util.MimeType mimeType)
     
    protected reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer>
    encode(Object value, org.springframework.core.io.buffer.DataBufferFactory bufferFactory, org.springframework.core.ResolvableType valueType, org.springframework.util.MimeType mimeType, Map<String,Object> hints)
     
    org.springframework.core.io.buffer.DataBuffer
    encodeValue(Object value, org.springframework.core.io.buffer.DataBufferFactory bufferFactory, org.springframework.core.ResolvableType valueType, org.springframework.util.MimeType mimeType, Map<String,Object> hints)
     
    Return the configured processor for customizing Marshaller instances.
    void
    Configure a processor function to customize Marshaller instances.

    Methods inherited from class org.springframework.core.codec.AbstractSingleValueEncoder

    encode

    Methods inherited from class org.springframework.core.codec.AbstractEncoder

    getEncodableMimeTypes, getLogger, setLogger

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.core.codec.Encoder

    getEncodableMimeTypes
  • Constructor Details

    • Jaxb2XmlEncoder

      public Jaxb2XmlEncoder()
  • Method Details

    • setMarshallerProcessor

      public void setMarshallerProcessor(Function<Marshaller,Marshaller> processor)
      Configure a processor function to customize Marshaller instances.
      Parameters:
      processor - the function to use
      Since:
      5.1.3
    • getMarshallerProcessor

      public Function<Marshaller,Marshaller> getMarshallerProcessor()
      Return the configured processor for customizing Marshaller instances.
      Since:
      5.1.3
    • canEncode

      public boolean canEncode(org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType)
      Specified by:
      canEncode in interface org.springframework.core.codec.Encoder<Object>
      Overrides:
      canEncode in class org.springframework.core.codec.AbstractEncoder<Object>
    • encode

      protected reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer> encode(Object value, org.springframework.core.io.buffer.DataBufferFactory bufferFactory, org.springframework.core.ResolvableType valueType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints)
      Specified by:
      encode in class org.springframework.core.codec.AbstractSingleValueEncoder<Object>
    • encodeValue

      public org.springframework.core.io.buffer.DataBuffer encodeValue(Object value, org.springframework.core.io.buffer.DataBufferFactory bufferFactory, org.springframework.core.ResolvableType valueType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints)