org.apache.camel.language.simple
Class FileLanguage
java.lang.Object
org.apache.camel.language.simple.SimpleLanguageSupport
org.apache.camel.language.simple.FileLanguage
- All Implemented Interfaces:
- IsSingleton, Language
public class FileLanguage
- extends SimpleLanguageSupport
File language is an extension to Simple language to add file specific expressions.
Examples of supported file expressions are:
- file:name to access the file name (is relative, see note below))
- file:name.noext to access the file name with no extension
- file:ext to access the file extension
- file:onlyname to access the file name (no paths)
- file:onlyname.noext to access the file name (no paths) with no extension
- file:parent to access the parent file name
- file:path to access the file path name
- file:absolute is the file regarded as absolute or relative
- file:absolute.path to access the absolute file path name
- file:length to access the file length as a Long type
- file:modified to access the file last modified as a Date type
- date:<command>:<pattern> for date formatting using the
SimpleDateFormat
patterns.
Additional Supported commands are: file for the last modified timestamp of the file.
All the commands from SimpleLanguage
is also avaiable.
The relative file is the filename with the starting directory clipped, as opposed to path that will
return the full path including the starting directory.
The only file is the filename only with all paths clipped.
All the simple expression is also available so you can eg use ${in.header.foo} to access the foo header.
- See Also:
SimpleLanguage
,
BeanLanguage
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileLanguage
public FileLanguage()
file
public static Expression file(String expression)
createSimpleExpression
protected Expression createSimpleExpression(String expression,
boolean strict)
- Description copied from class:
SimpleLanguageSupport
- Creates the simple expression based on the extracted content from the ${ } place holders
- Specified by:
createSimpleExpression
in class SimpleLanguageSupport
- Parameters:
expression
- the content between ${ and }strict
- whether it is strict mode or not, if strict it will throw a
ExpressionIllegalSyntaxException
if the expression was not known.
Set to false to support constant expressions
- Returns:
- the expression
isSingleton
public boolean isSingleton()
- Description copied from interface:
IsSingleton
- Wheter this class supports being singleton or not.
- Returns:
- true to be a single shared instance, false to create new instances.
Copyright © 2009 Apache Software Foundation. All Rights Reserved.