Class BuilderSupport

  • All Implemented Interfaces:
    org.apache.camel.CamelContextAware
    Direct Known Subclasses:
    RouteBuilder

    public abstract class BuilderSupport
    extends Object
    implements org.apache.camel.CamelContextAware
    Base class for implementation inheritance for different clauses in the Java DSL
    • Constructor Detail

      • BuilderSupport

        protected BuilderSupport()
      • BuilderSupport

        protected BuilderSupport​(org.apache.camel.CamelContext context)
    • Method Detail

      • header

        public ValueBuilder header​(String name)
        Returns a value builder for the given header
      • exchangeProperty

        public ValueBuilder exchangeProperty​(String name)
        Returns a value builder for the given exchange property
      • body

        public ValueBuilder body()
        Returns a predicate and value builder for the inbound body on an exchange
      • bodyAs

        public <T> ValueBuilder bodyAs​(Class<T> type)
        Returns a predicate and value builder for the inbound message body as a specific type
      • systemProperty

        public ValueBuilder systemProperty​(String name)
        Returns a value builder for the given system property
      • systemProperty

        public ValueBuilder systemProperty​(String name,
                                           String defaultValue)
        Returns a value builder for the given system property
      • constant

        public ValueBuilder constant​(Object value)
        Returns a constant expression value builder
      • constant

        public ValueBuilder constant​(Object value,
                                     boolean trim)
        Returns a constant expression value builder
      • constant

        public ValueBuilder constant​(Object... value)
        Returns a constant expression value builder
      • joor

        public ValueBuilder joor​(String value)
        Returns a JOOR expression value builder
      • jsonpath

        public ValueBuilder jsonpath​(String value)
        Returns a JSonPath expression value builder
      • jsonpath

        public ValueBuilder jsonpath​(String value,
                                     Class<?> resultType)
        Returns a JSonPath expression value builder
        Parameters:
        value - The JSonPath expression
        resultType - The result type that the JSonPath expression will return.
      • csimple

        public ValueBuilder csimple​(String value)
        Returns a compiled simple expression value builder
      • csimple

        public ValueBuilder csimple​(String value,
                                    Class<?> resultType)
        Returns a compiled simple expression value builder
      • datasonnet

        public ValueBuilder datasonnet​(String value)
        Returns a datasonnet expression value builder
      • datasonnet

        public ValueBuilder datasonnet​(String value,
                                       Class<?> resultType)
        Returns a datasonnet expression value builder
      • datasonnet

        public ValueBuilder datasonnet​(String value,
                                       Class<?> resultType,
                                       String bodyMediaType,
                                       String outputMediaType)
        Returns a datasonnet expression value builder
      • simple

        public ValueBuilder simple​(String value)
        Returns a simple expression value builder
      • simple

        public ValueBuilder simple​(String value,
                                   Class<?> resultType)
        Returns a simple expression value builder
      • simpleF

        public ValueBuilder simpleF​(String format,
                                    Object... values)
        Returns a simple expression value builder, using String.format style
      • simpleF

        public ValueBuilder simpleF​(String format,
                                    Class<?> resultType,
                                    Object... values)
        Returns a simple expression value builder, using String.format style
      • xpath

        public ValueBuilder xpath​(String value)
        Returns a xpath expression value builder
        Parameters:
        value - the XPath expression
        Returns:
        the builder
      • xpath

        public ValueBuilder xpath​(String value,
                                  Class<?> resultType)
        Returns a xpath expression value builder
        Parameters:
        value - the XPath expression
        resultType - the result type that the XPath expression will return.
        Returns:
        the builder
      • xpath

        public ValueBuilder xpath​(String value,
                                  org.apache.camel.support.builder.Namespaces namespaces)
        Returns a xpath expression value builder
        Parameters:
        value - the XPath expression
        namespaces - namespace mappings
        Returns:
        the builder
      • xpath

        public ValueBuilder xpath​(String value,
                                  Class<?> resultType,
                                  org.apache.camel.support.builder.Namespaces namespaces)
        Returns a xpath expression value builder
        Parameters:
        value - the XPath expression
        resultType - the result type that the XPath expression will return.
        namespaces - namespace mappings
        Returns:
        the builder
      • method

        public ValueBuilder method​(Object beanOrBeanRef)
        Returns a method call expression value builder

        This method accepts dual parameters. Either an bean instance or a reference to a bean (String).

        Parameters:
        beanOrBeanRef - either an instanceof a bean or a reference to bean to lookup in the Registry
        Returns:
        the builder
      • method

        public ValueBuilder method​(Object beanOrBeanRef,
                                   String method)
        Returns a method call expression value builder

        This method accepts dual parameters. Either an bean instance or a reference to a bean (String).

        Parameters:
        beanOrBeanRef - either an instanceof a bean or a reference to bean to lookup in the Registry
        method - name of method to invoke
        Returns:
        the builder
      • method

        public ValueBuilder method​(Class<?> beanType)
        Returns a method call expression value builder
        Parameters:
        beanType - the Class of the bean which we want to invoke
        Returns:
        the builder
      • method

        public ValueBuilder method​(Class<?> beanType,
                                   String method)
        Returns a method call expression value builder
        Parameters:
        beanType - the Class of the bean which we want to invoke
        method - name of method to invoke
        Returns:
        the builder
      • regexReplaceAll

        public ValueBuilder regexReplaceAll​(org.apache.camel.Expression content,
                                            String regex,
                                            String replacement)
        Returns an expression value builder that replaces all occurrences of the regular expression with the given replacement
      • regexReplaceAll

        public ValueBuilder regexReplaceAll​(org.apache.camel.Expression content,
                                            String regex,
                                            org.apache.camel.Expression replacement)
        Returns an expression value builder that replaces all occurrences of the regular expression with the given replacement
      • exceptionMessage

        public ValueBuilder exceptionMessage()
        Returns a exception expression value builder
      • endpoint

        @Deprecated
        public org.apache.camel.Endpoint endpoint​(String uri)
                                           throws org.apache.camel.NoSuchEndpointException
        Deprecated.
        use CamelContext.getEndpoint(String) instead
        Resolves the given URI to an endpoint
        Parameters:
        uri - the uri to resolve
        Returns:
        the endpoint
        Throws:
        org.apache.camel.NoSuchEndpointException - if the endpoint URI could not be resolved
      • endpoint

        @Deprecated
        public <T extends org.apache.camel.Endpoint> T endpoint​(String uri,
                                                                Class<T> type)
                                                         throws org.apache.camel.NoSuchEndpointException
        Deprecated.
        use CamelContext.getEndpoint(String, Class) instead
        Resolves the given URI to an endpoint of the specified type
        Parameters:
        uri - the uri to resolve
        type - the excepted type of the endpoint
        Returns:
        the endpoint
        Throws:
        org.apache.camel.NoSuchEndpointException - if the endpoint URI could not be resolved
      • endpoints

        @Deprecated
        public List<org.apache.camel.Endpoint> endpoints​(String... uris)
                                                  throws org.apache.camel.NoSuchEndpointException
        Deprecated.
        use CamelContext.getEndpoint(String) instead
        Resolves the list of URIs into a list of Endpoint instances
        Parameters:
        uris - list of endpoints to resolve
        Returns:
        list of endpoints
        Throws:
        org.apache.camel.NoSuchEndpointException - if an endpoint URI could not be resolved
      • endpoints

        @Deprecated
        public List<org.apache.camel.Endpoint> endpoints​(org.apache.camel.Endpoint... endpoints)
        Deprecated.
        Helper method to create a list of Endpoint instances
        Parameters:
        endpoints - endpoints
        Returns:
        list of the given endpoints
      • deadLetterChannel

        public DeadLetterChannelBuilder deadLetterChannel​(String deadLetterUri)
        Dead Letter Channel EIP: is a error handler for handling messages that could not be delivered to it's intended destination.
        Parameters:
        deadLetterUri - uri to the dead letter endpoint storing dead messages
        Returns:
        the builder
      • deadLetterChannel

        public DeadLetterChannelBuilder deadLetterChannel​(org.apache.camel.Endpoint deadLetterEndpoint)
        Dead Letter Channel EIP: is a error handler for handling messages that could not be delivered to it's intended destination.
        Parameters:
        deadLetterEndpoint - dead letter endpoint storing dead messages
        Returns:
        the builder
      • jtaTransactionErrorHandler

        public JtaTransactionErrorHandlerBuilder jtaTransactionErrorHandler()
        Error handler using JTA transactions (requires camel-jta).
        Returns:
        the builder
      • jtaTransactionErrorHandler

        public JtaTransactionErrorHandlerBuilder jtaTransactionErrorHandler​(org.apache.camel.spi.TransactedPolicy policy)
        Error handler using JTA transactions (requires camel-jta).
        Parameters:
        policy - the transaction policy
        Returns:
        the builder
      • jtaTransactionErrorHandler

        public JtaTransactionErrorHandlerBuilder jtaTransactionErrorHandler​(String policyRef)
        Error handler using JTA transactions (requires camel-jta).
        Parameters:
        policyRef - references to the transaction policy
        Returns:
        the builder
      • springTransactionErrorHandler

        public SpringTransactionErrorHandlerBuilder springTransactionErrorHandler()
        Error handler using Spring transactions (requires camel-spring).
        Returns:
        the builder
      • springTransactionErrorHandler

        public SpringTransactionErrorHandlerBuilder springTransactionErrorHandler​(org.apache.camel.spi.TransactedPolicy policy)
        Error handler using Spring transactions (requires camel-spring).
        Parameters:
        policy - the transaction policy
        Returns:
        the builder
      • springTransactionErrorHandler

        public SpringTransactionErrorHandlerBuilder springTransactionErrorHandler​(String policyRef)
        Error handler using Spring transactions (requires camel-spring).
        Parameters:
        policyRef - references to the transaction policy
        Returns:
        the builder
      • getCamelContext

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

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

        public org.apache.camel.CamelContext getContext()
        Get the CamelContext
        Returns:
        camelContext the Camel context
      • getErrorHandlerFactory

        public org.apache.camel.ErrorHandlerFactory getErrorHandlerFactory()
      • createErrorHandlerBuilder

        protected org.apache.camel.ErrorHandlerFactory createErrorHandlerBuilder()
      • setErrorHandlerFactory

        public void setErrorHandlerFactory​(org.apache.camel.ErrorHandlerFactory errorHandlerFactory)
        Sets the error handler to use with processors created by this builder
      • hasErrorHandlerFactory

        public boolean hasErrorHandlerFactory()
        Returns:
        true if it an error handler factory was initialized