001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.camel; 018 019/** 020 * A predicate which evaluates a binary expression. 021 * <p/> 022 * The predicate has a left and right hand side expressions which 023 * is matched based on an operator. 024 * <p/> 025 * This predicate offers the {@link #matchesReturningFailureMessage} method 026 * which evaluates and returns a detailed failure message if the predicate did not match. 027 */ 028public interface BinaryPredicate extends Predicate { 029 030 /** 031 * Gets the operator 032 * 033 * @return the operator text 034 */ 035 String getOperator(); 036 037 /** 038 * Gets the left hand side expression 039 * 040 * @return the left expression 041 */ 042 Expression getLeft(); 043 044 /** 045 * Gets the right hand side expression 046 * 047 * @return the right expression 048 */ 049 Expression getRight(); 050 051 /** 052 * Evaluates the predicate on the message exchange and returns <tt>null</tt> if this 053 * exchange matches the predicate. If it did <b>not</b> match, then a failure message 054 * is returned detailing the reason, which can be used by end users to understand 055 * the failure. 056 * 057 * @param exchange the message exchange 058 * @return <tt>null</tt> if the predicate matches. 059 */ 060 String matchesReturningFailureMessage(Exchange exchange); 061 062}