Class LanguageSupport

java.lang.Object
org.apache.camel.support.LanguageSupport
All Implemented Interfaces:
org.apache.camel.CamelContextAware, org.apache.camel.IsSingleton, org.apache.camel.spi.HasCamelContext, org.apache.camel.spi.Language
Direct Known Subclasses:
TypedLanguageSupport

public abstract class LanguageSupport extends Object implements org.apache.camel.spi.Language, org.apache.camel.IsSingleton, org.apache.camel.CamelContextAware
Base language for Language implementations.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.camel.CamelContext
     
    static boolean
    Does the expression include a simple function.
    protected boolean
    Does the expression refer to a dynamic resource which uses simple functions.
    boolean
     
    protected boolean
    Does the expression refer to a static resource.
    protected String
    loadResource(String expression)
    Loads the resource if the given expression is referring to an external resource by using the syntax resource:scheme:uri.
    protected <T> T
    property(Class<T> type, Object[] properties, int index, Object defaultValue)
    Converts the property to the expected type
    void
    setCamelContext(org.apache.camel.CamelContext camelContext)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.camel.spi.Language

    createExpression, createExpression, createPredicate, createPredicate
  • Field Details

  • Constructor Details

    • LanguageSupport

      public LanguageSupport()
  • Method Details

    • getCamelContext

      public org.apache.camel.CamelContext getCamelContext()
      Specified by:
      getCamelContext in interface org.apache.camel.spi.HasCamelContext
    • setCamelContext

      public void setCamelContext(org.apache.camel.CamelContext camelContext)
      Specified by:
      setCamelContext in interface org.apache.camel.CamelContextAware
    • isSingleton

      public boolean isSingleton()
      Specified by:
      isSingleton in interface org.apache.camel.IsSingleton
    • loadResource

      protected String loadResource(String expression) throws org.apache.camel.ExpressionIllegalSyntaxException
      Loads the resource if the given expression is referring to an external resource by using the syntax resource:scheme:uri. If the expression is not referring to a resource, then its returned as is.

      For example resource:classpath:mygroovy.groovy to refer to a groovy script on the classpath.

      Parameters:
      expression - the expression
      Returns:
      the expression
      Throws:
      org.apache.camel.ExpressionIllegalSyntaxException - is thrown if error loading the resource
    • isStaticResource

      protected boolean isStaticResource(String expression)
      Does the expression refer to a static resource.
    • isDynamicResource

      protected boolean isDynamicResource(String expression)
      Does the expression refer to a dynamic resource which uses simple functions.
    • hasSimpleFunction

      public static boolean hasSimpleFunction(String expression)
      Does the expression include a simple function.
      Parameters:
      expression - the expression
      Returns:
      true if one or more simple function is included in the expression
    • property

      protected <T> T property(Class<T> type, Object[] properties, int index, Object defaultValue)
      Converts the property to the expected type
      Parameters:
      type - the expected type
      properties - the options (optimized as object array with hardcoded positions for properties)
      index - index of the property
      defaultValue - optional default value
      Returns:
      the value converted to the expected type