Class AbstractFilePayloadTransformer<T>

java.lang.Object
org.springframework.integration.file.transformer.AbstractFilePayloadTransformer<T>
Type Parameters:
T - the expected payload type.
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.integration.transformer.GenericTransformer<org.springframework.messaging.Message<?>,​org.springframework.messaging.Message<?>>, org.springframework.integration.transformer.Transformer
Direct Known Subclasses:
FileToByteArrayTransformer, FileToStringTransformer

public abstract class AbstractFilePayloadTransformer<T>
extends java.lang.Object
implements org.springframework.integration.transformer.Transformer, org.springframework.beans.factory.BeanFactoryAware
Base class for transformers that convert a File payload.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected org.apache.commons.logging.Log logger  
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractFilePayloadTransformer()  
  • Method Summary

    Modifier and Type Method Description
    protected org.springframework.integration.support.MessageBuilderFactory getMessageBuilderFactory()  
    void setBeanFactory​(org.springframework.beans.factory.BeanFactory beanFactory)  
    void setDeleteFiles​(boolean deleteFiles)
    Specify whether to delete the File after transformation.
    org.springframework.messaging.Message<?> transform​(org.springframework.messaging.Message<?> message)  
    protected abstract T transformFile​(java.io.File file)
    Subclasses must implement this method to transform the File contents.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      protected final org.apache.commons.logging.Log logger
  • Constructor Details

  • Method Details

    • setDeleteFiles

      public void setDeleteFiles​(boolean deleteFiles)
      Specify whether to delete the File after transformation. Default is false.
      Parameters:
      deleteFiles - true to delete the file.
    • setBeanFactory

      public void setBeanFactory​(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
      Specified by:
      setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
      Throws:
      org.springframework.beans.BeansException
    • getMessageBuilderFactory

      protected org.springframework.integration.support.MessageBuilderFactory getMessageBuilderFactory()
    • transform

      public final org.springframework.messaging.Message<?> transform​(org.springframework.messaging.Message<?> message)
      Specified by:
      transform in interface org.springframework.integration.transformer.GenericTransformer<org.springframework.messaging.Message<?>,​org.springframework.messaging.Message<?>>
      Specified by:
      transform in interface org.springframework.integration.transformer.Transformer
    • transformFile

      protected abstract T transformFile​(java.io.File file) throws java.io.IOException
      Subclasses must implement this method to transform the File contents.
      Parameters:
      file - The file.
      Returns:
      The result of the transformation.
      Throws:
      java.io.IOException - Any IOException.