Interface RouteTemplateContext

All Superinterfaces:
HasCamelContext

public interface RouteTemplateContext extends HasCamelContext
The context used during creating a Route from a route template.
  • Method Details

    • bind

      default void bind(String id, Object bean)
      Binds the bean to the repository (if possible). If the bean is CamelContextAware then the registry will automatically inject the context if possible.
      Parameters:
      id - the id of the bean
      bean - the bean
    • bind

      void bind(String id, Class<?> type, Object bean)
      Binds the bean to the repository (if possible).

      Binding by id and type allows to bind multiple entries with the same id but with different type. If the bean is CamelContextAware then the registry will automatically inject the context if possible.

      Parameters:
      id - the id of the bean
      type - the type of the bean to associate the binding
      bean - the bean
    • bind

      void bind(String id, Class<?> type, Supplier<Object> bean)
      Binds the bean (via a supplier) to the repository (if possible).

      Camel will cache the result from the supplier from first lookup (singleton scope). If you do not need cached then use bindAsPrototype(String, Class, Supplier) instead.

      Binding by id and type allows to bind multiple entries with the same id but with different type. If the bean is CamelContextAware then the registry will automatically inject the context if possible.

      Parameters:
      id - the id of the bean
      type - the type of the bean to associate the binding
      bean - a supplier for the bean
    • bindAsPrototype

      void bindAsPrototype(String id, Class<?> type, Supplier<Object> bean)
      Binds the bean (via a supplier) to the repository (if possible).

      Notice that the supplier will be called each time the bean is being looked up (not cached).

      Binding by id and type allows to bind multiple entries with the same id but with different type. If the bean is CamelContextAware then the registry will automatically inject the context if possible.

      Parameters:
      id - the id of the bean
      type - the type of the bean to associate the binding
      bean - a supplier for the bean
    • getProperty

      Object getProperty(String name)
      Gets the property with the given name
      Parameters:
      name - name of property
      Returns:
      the property value or null if no property exists
    • getProperty

      <T> T getProperty(String name, Class<?> type)
      Gets the property with the given name
      Parameters:
      name - name of property
      type - the type of the property
      Returns:
      the property value or null if no property exists
      Throws:
      TypeConversionException - is thrown if error during type conversion
    • setParameter

      void setParameter(String name, Object value)
      Sets a parameter
      Parameters:
      name - the parameter name
      value - the parameter value
    • getParameters

      Map<String,Object> getParameters()
      The parameters to use for the route template when creating the new route
    • hasParameter

      boolean hasParameter(String name)
      Whether the route template has a parameter with the given name
      Parameters:
      name - the parameter name
      Returns:
      true if exists
    • getLocalBeanRepository

      BeanRepository getLocalBeanRepository()
      Gets the local bean repository for the route template when creating the new route
    • setConfigurer

      void setConfigurer(Consumer<RouteTemplateContext> configurer)
      Sets a custom configurer which allows to do configuration while the route template is being used to create a route. This gives control over the creating process, such as binding local beans and doing other kind of customization.
      Parameters:
      configurer - the configurer with callback to invoke with the given route template context
    • getConfigurer

      Consumer<RouteTemplateContext> getConfigurer()
      Gets the custom configurer.