1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krms.framework.engine.expression; |
17 | |
|
18 | |
import java.util.Collections; |
19 | |
import java.util.List; |
20 | |
|
21 | |
import org.kuali.rice.krms.api.engine.ExecutionEnvironment; |
22 | |
import org.kuali.rice.krms.framework.engine.Proposition; |
23 | |
import org.kuali.rice.krms.framework.engine.PropositionResult; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
public class ExpressionBasedProposition implements Proposition { |
32 | |
|
33 | |
private final Expression<Boolean> expression; |
34 | |
|
35 | 0 | public ExpressionBasedProposition(Expression<Boolean> expression) { |
36 | 0 | this.expression = expression; |
37 | 0 | } |
38 | |
|
39 | |
@Override |
40 | |
public PropositionResult evaluate(ExecutionEnvironment environment) { |
41 | 0 | return new PropositionResult(expression.invoke(environment).booleanValue()); |
42 | |
} |
43 | |
|
44 | |
|
45 | |
@Override |
46 | |
public List<Proposition> getChildren() { |
47 | 0 | return Collections.emptyList(); |
48 | |
} |
49 | |
|
50 | |
@Override |
51 | |
public boolean isCompound() { |
52 | 0 | return false; |
53 | |
} |
54 | |
} |