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 |
---|---|
String |
generateFileName(Message<?> message) |
void |
setExpression(String expression)
Specify an expression to be evaluated against the Message
in order to generate a file name.
|
void |
setHeaderName(String headerName)
Specify a custom header name to check for the file name.
|
afterPropertiesSet, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, getEvaluationContext, getEvaluationContext, getMessageBuilderFactory, setBeanFactory, setConversionService
public void setExpression(String expression)
expression
- The expression.public void setHeaderName(String headerName)
FileHeaders.FILENAME
.headerName
- The header name.public String generateFileName(Message<?> message)
generateFileName
in interface FileNameGenerator