Spring Integration

org.springframework.integration.file
Class DefaultFileNameGenerator

java.lang.Object
  extended by org.springframework.integration.file.DefaultFileNameGenerator
All Implemented Interfaces:
FileNameGenerator

public class DefaultFileNameGenerator
extends Object
implements FileNameGenerator

Default implementation of the filename generator strategy. It first checks for a message header whose name matches its 'headerName' property. The default header name is defined by the constant FileHeaders.FILENAME. A custom header name can be provided via setHeaderName(String). If no String-typed value is associated with that header it checks if the Message payload is a File instance, and if so, it uses the same name. Finally, it falls back to the Message ID and adds the suffix '.msg'.

Author:
Mark Fisher

Constructor Summary
DefaultFileNameGenerator()
           
 
Method Summary
 String generateFileName(Message<?> message)
           
 void setHeaderName(String headerName)
          Specify a custom header name to check for the file name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFileNameGenerator

public DefaultFileNameGenerator()
Method Detail

setHeaderName

public void setHeaderName(String headerName)
Specify a custom header name to check for the file name. The default is defined by FileHeaders.FILENAME.


generateFileName

public String generateFileName(Message<?> message)
Specified by:
generateFileName in interface FileNameGenerator

Spring Integration

Copyright © 2010. All Rights Reserved.