Package org.apache.camel.component.dozer
Class ExpressionMapper
- java.lang.Object
-
- org.apache.camel.component.dozer.BaseConverter
-
- org.apache.camel.component.dozer.ExpressionMapper
-
- All Implemented Interfaces:
com.github.dozermapper.core.ConfigurableCustomConverter,com.github.dozermapper.core.CustomConverter
public class ExpressionMapper extends BaseConverter
Provides support for mapping a Camel expression to a target field in a mapping. Expressions have the following format:
[language]:[expression]
-
-
Constructor Summary
Constructors Constructor Description ExpressionMapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectconvert(Object existingDestinationFieldValue, Object sourceFieldValue, Class<?> destinationClass, Class<?> sourceClass)StringgetExpression()Used as the source field for Dozer mappings.StringgetExpressionPart()The actual expression, without the language prefix.StringgetLanguagePart()The expression language used for this mapping.StringgetPathPart()The path used for this mapping's resource file.StringgetSchemePart()The scheme used for this mapping's resource file (classpath, file, http).protected InputStreamloadResource(String uri)Loads the given resource.protected StringresolveScript(String script)Resolves the script.voidsetCurrentExchange(org.apache.camel.Exchange exchange)Sets the Camel exchange reference for this mapping.-
Methods inherited from class org.apache.camel.component.dozer.BaseConverter
done, getParameter, setParameter
-
-
-
-
Method Detail
-
convert
public Object convert(Object existingDestinationFieldValue, Object sourceFieldValue, Class<?> destinationClass, Class<?> sourceClass)
-
resolveScript
protected String resolveScript(String script) throws IOException
Resolves the script.- Parameters:
script- script or uri for a script to load- Returns:
- the script
- Throws:
IOException- is thrown if error loading the script
-
loadResource
protected InputStream loadResource(String uri) throws IOException
Loads the given resource.- Parameters:
uri- uri of the resource.- Returns:
- the loaded resource
- Throws:
IOException- is thrown if resource is not found or cannot be loaded
-
getExpression
public String getExpression()
Used as the source field for Dozer mappings.
-
getExpressionPart
public String getExpressionPart()
The actual expression, without the language prefix.
-
getLanguagePart
public String getLanguagePart()
The expression language used for this mapping.
-
setCurrentExchange
public void setCurrentExchange(org.apache.camel.Exchange exchange)
Sets the Camel exchange reference for this mapping. The exchange reference is stored in a thread-local which is cleaned up after the mapping has been performed via the done() method.- Parameters:
exchange-
-
getSchemePart
public String getSchemePart()
The scheme used for this mapping's resource file (classpath, file, http).
-
getPathPart
public String getPathPart()
The path used for this mapping's resource file.
-
-