View Javadoc

1   /**
2    * Copyright 2005-2015 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 org.kuali.rice.krms.api.engine.ExecutionEnvironment;
19  import org.kuali.rice.krms.api.engine.Term;
20  import org.kuali.rice.krms.api.engine.TermResolutionException;
21  
22  /**
23   * An implementation of {@link Expression} which resolves the given {@link Term}.
24   * 
25   * @author Kuali Rice Team (rice.collab@kuali.org)
26   *
27   */
28  public final class TermExpression implements Expression<Object> {
29  
30  	private final Term term;
31  
32      /**
33       * Create a TermExpression with the given value
34       * @param term {@link Term} to invoke upon.
35       */
36  	public TermExpression(Term term) {
37  		this.term = term;
38  	}
39  
40  	/**
41  	 * @see org.kuali.rice.krms.framework.engine.expression.Expression#invoke(org.kuali.rice.krms.api.engine.ExecutionEnvironment)
42  	 * @throws TermResolutionException if there is a problem resolving the {@link Term}
43  	 */
44  	@Override
45  	public Object invoke(ExecutionEnvironment environment) {
46  	    return environment.resolveTerm(term, this);
47  	}
48  
49  }