View Javadoc

1   /*
2    * Copyright 2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 1.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/ecl1.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.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  
24  /**
25   * TODO... 
26   * 
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   *
29   */
30  public class ExpressionBasedProposition implements Proposition {
31  
32  	private final Expression<Boolean> expression;
33  	
34  	public ExpressionBasedProposition(Expression<Boolean> expression) {
35  		this.expression = expression;
36  	}
37  	
38  	@Override
39  	public boolean evaluate(ExecutionEnvironment environment) {
40  		return expression.invoke(environment).booleanValue();
41  	}
42  
43  
44      @Override
45      public List<Proposition> getChildren() {
46          return Collections.emptyList();
47      }
48      
49      @Override
50      public boolean isCompound() {
51          return false;
52      }
53  }