org.springframework.core.codec

Class AbstractEncoder<T>

  • java.lang.Object
    • org.springframework.core.codec.AbstractEncoder<T>
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      protected Log logger 
    • Constructor Summary

      Constructors 
      Modifier Constructor and Description
      protected AbstractEncoder(MimeType... supportedMimeTypes) 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean canEncode(ResolvableType elementType, MimeType mimeType)
      Whether the encoder supports the given source element type and the MIME type for the output stream.
      java.util.List<MimeType> getEncodableMimeTypes()
      Return the list of mime types this encoder supports.
      Log getLogger()
      Return the currently configured Logger.
      void setLogger(Log logger)
      Set an alternative logger to use than the one based on the class name.
      • 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

        encode
    • Field Detail

      • logger

        protected Log logger
    • Constructor Detail

      • AbstractEncoder

        protected AbstractEncoder(MimeType... supportedMimeTypes)
    • Method Detail

      • setLogger

        public void setLogger(Log logger)
        Set an alternative logger to use than the one based on the class name.
        Parameters:
        logger - the logger to use
        Since:
        5.1
      • getLogger

        public Log getLogger()
        Return the currently configured Logger.
        Since:
        5.1
      • getEncodableMimeTypes

        public java.util.List<MimeType> getEncodableMimeTypes()
        Description copied from interface: Encoder
        Return the list of mime types this encoder supports.
        Specified by:
        getEncodableMimeTypes in interface Encoder<T>
      • canEncode

        public boolean canEncode(ResolvableType elementType,
                                 @Nullable
                                 MimeType mimeType)
        Description copied from interface: Encoder
        Whether the encoder supports the given source element type and the MIME type for the output stream.
        Specified by:
        canEncode in interface Encoder<T>
        Parameters:
        elementType - the type of elements in the source stream
        mimeType - the MIME type for the output stream (can be null if not specified)
        Returns:
        true if supported, false otherwise