Class PredicateClause<T>

java.lang.Object
org.apache.camel.builder.PredicateClause<T>
All Implemented Interfaces:
org.apache.camel.Predicate

public class PredicateClause<T> extends Object implements org.apache.camel.Predicate
  • Constructor Details

    • PredicateClause

      public PredicateClause(T parent)
  • Method Details

    • matches

      public boolean matches(org.apache.camel.Exchange exchange)
      Specified by:
      matches in interface org.apache.camel.Predicate
    • exchange

      public T exchange(Predicate<org.apache.camel.Exchange> predicate)
      Define a Predicate which targets the Exchange.
    • message

      public T message(Predicate<org.apache.camel.Message> predicate)
      Define a Predicate which targets the Exchange In Message.
       
       from("direct:aggregate")
               .choice()
               .when()
               .message(m -> m.getBody() != null)
               .log("Received ${body}")
               .endChoice()
       
       
    • body

      public T body(Predicate<Object> predicate)
      Define a Predicate which targets the Exchange In Body.
       
       from("direct:aggregate")
               .choice()
               .when()
               .body(b -> b != null)
               .log("Received ${body}")
               .endChoice()
       
       
    • body

      public <B> T body(Class<B> type, Predicate<B> predicate)
      Define a Predicate which targets the typed Exchange In Body.
       
       from("direct:aggregate")
               .choice()
               .when()
               .body(Long.class, b -> (b & 1) == 0)
               .log("Received even number ${body}")
               .endChoice()
       
       
    • body

      public T body(BiPredicate<Object,Map<String,Object>> predicate)
      Define a Predicate which targets the Exchange In Body and its Headers.
       
       from("direct:aggregate")
               .choice()
               .when()
               .body((b, h) -> b != null || h.containsKy("ToProcess"))
               .log("Received ${body}")
               .endChoice()
       
       
    • body

      public <B> T body(Class<B> type, BiPredicate<B,Map<String,Object>> predicate)
      Define a Predicate which targets the typed Exchange In Body and its Headers.
       
       from("direct:aggregate")
               .choice()
               .when()
               .body(String.class, (b, h) -> b != null && !b.isEmpty() || h.containsKy("ToProcess"))
               .log("Received ${body}")
               .endChoice()