public class DefaultFileNameGenerator extends AbstractExpressionEvaluator implements FileNameGenerator
setHeaderName(String)
method for convenience. If neither a header name nor custom expression is set,
the default header name is defined by the constant FileHeaders.FILENAME
.
If no String-typed value is returned from the expression evaluation (or
associated with the header if no expression has been provided), 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'.Constructor and Description |
---|
DefaultFileNameGenerator() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
generateFileName(Message<?> message) |
void |
setExpression(java.lang.String expression)
Specify an expression to be evaluated against the Message
in order to generate a file name.
|
void |
setHeaderName(java.lang.String headerName)
Specify a custom header name to check for the file name.
|
afterPropertiesSet, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, getEvaluationContext, getEvaluationContext, setBeanFactory, setConversionService
public void setExpression(java.lang.String expression)
public void setHeaderName(java.lang.String headerName)
FileHeaders.FILENAME
.public java.lang.String generateFileName(Message<?> message)
generateFileName
in interface FileNameGenerator