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 */
017 package org.apache.camel;
018
019 /**
020 * A predicate which is evaluating 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 return a detailed failure message if the predicate did not match.
027 *
028 * @version
029 */
030 public interface BinaryPredicate extends Predicate {
031
032 /**
033 * Gets the operator
034 *
035 * @return the operator text
036 */
037 String getOperator();
038
039 /**
040 * Gets the left hand side expression
041 *
042 * @return the left expression
043 */
044 Expression getLeft();
045
046 /**
047 * Gets the right hand side expression
048 *
049 * @return the right expression
050 */
051 Expression getRight();
052
053 /**
054 * Evaluates the predicate on the message exchange and returns <tt>null</tt> if this
055 * exchange matches the predicate. If it did <b>not</b> match, then a failure message
056 * is returned detailing why it did not fail, which can be used for end users to understand
057 * the failure.
058 *
059 * @param exchange the message exchange
060 * @return <tt>null</tt> if the predicate matches.
061 */
062 String matchesReturningFailureMessage(Exchange exchange);
063
064 }