Class 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 Detail

      • ExpressionMapper

        public ExpressionMapper()
    • 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.