View Javadoc

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