Interface Language


public interface Language
SPI base for every Camel expression and predicate language.

Implementations include simple, groovy, jexl, mvel, xpath, jsonpath, spel, and many others. They are resolved by name via CamelContext.resolveLanguage(String), which first checks the Camel registry and then falls back to the classpath service loader at LanguageResolver.resolveLanguage(String, org.apache.camel.CamelContext). The two core factory methods — createExpression(String) and createPredicate(String) — accept a text expression and return a thread-safe, reusable instance. The overloaded Object[] variants allow passing pre-parsed language-specific options (e.g., XPath namespace maps or tokenizer delimiters) to avoid repeated parsing overhead. All implementations must be thread-safe because expressions and predicates are evaluated concurrently on multiple exchanges.

See Languages in the Camel user manual.

See Also:
  • Method Details

    • createPredicate

      Predicate createPredicate(String expression)
      Creates a predicate based on only the given string input
      Parameters:
      expression - the expression as a string input
      Returns:
      the created predicate
    • createExpression

      Expression createExpression(String expression)
      Creates an expression based on only the given string input
      Parameters:
      expression - the expression as a string input
      Returns:
      the created expression
    • createPredicate

      default Predicate createPredicate(String expression, Object[] properties)
      Creates an expression based on the input with properties

      This is used for languages that have been configured with custom properties most noticeable for xpath/xquery/tokenizer languages that have several options.

      Parameters:
      expression - the expression
      properties - configuration properties (optimized as object array with hardcoded positions for properties)
      Returns:
      the created predicate
    • createExpression

      default Expression createExpression(String expression, Object[] properties)
      Creates an expression based on the input with properties

      This is used for languages that have been configured with custom properties most noticeable for xpath/xquery/tokenizer languages that have several options.

      Parameters:
      expression - the expression
      properties - configuration properties (optimized as object array with hardcoded positions for properties)
      Returns:
      the created expression