1 /**
2 * Copyright 2005-2012 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.rice.krms.api.engine.expression;
17
18 import org.kuali.rice.krms.framework.engine.expression.EngineComparatorExtension;
19 import org.kuali.rice.krms.framework.engine.expression.StringCoercionExtension;
20
21 import java.util.List;
22
23 /**
24 * Interface for registering {@link EngineComparatorExtension} for use as a
25 * {@link org.kuali.rice.krms.framework.engine.expression.ComparisonOperator} when comparing
26 * {@link org.kuali.rice.krms.framework.engine.Proposition} {@link Term}s
27 *
28 * @author Kuali Rice Team (rice.collab@kuali.org)
29 */
30 public interface ComparisonOperatorService extends StringCoercionExtension {
31
32 /**
33 * The {@link List} of {@link EngineComparatorExtension}s.
34 * @return List<EngineComparatorExtension> of configured {@link EngineComparatorExtension}s.
35 */
36 public List<EngineComparatorExtension> getOperators();
37
38 /**
39 * List<EngineComparatorExtension> to use.
40 * @param operators
41 */
42 public void setOperators(List<EngineComparatorExtension> operators);
43
44 /**
45 * Does the service have an Extension that can compare the given objects?
46 *
47 * @param leftHandSide left hand side Object
48 * @param rightHandSide right hand side Object
49 * @return boolean true a configured {@link EngineComparatorExtension} can compare the lhs and rhs Objects.
50 */
51 public boolean canCompare(Object leftHandSide, Object rightHandSide);
52
53 /**
54 * {@link EngineComparatorExtension} that canCompare the given Objects
55 * @param leftHandSide left hand side Object
56 * @param rightHandSide right hand side Object
57 * @return the EngineComparatorExtension that can compare the given Objects.
58 */
59 public EngineComparatorExtension findComparatorExtension(Object leftHandSide, Object rightHandSide);
60
61 /**
62 *
63 * @return List<StringCoercionExtension>
64 */
65 // this would move to a StringCoercionExtensionService if we go that way
66 public List<StringCoercionExtension> getStringCoercionExtensions();
67
68 /**
69 * The {@link List} of {@link StringCoercionExtension}s.
70 * @param stringCoercionExtensions
71 */
72 // this would move to a StringCoercionExtensionService if we go that way
73 public void setStringCoercionExtensions(List<StringCoercionExtension> stringCoercionExtensions);
74
75 /**
76 *
77 * @param type to coerce
78 * @param value to coerce
79 * @return {@link StringCoercionExtension} that can coerce the given type and value
80 */
81 // this would move to a StringCoercionExtensionService if we go that way
82 StringCoercionExtension findStringCoercionExtension(String type, String value);
83 }