KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > taglibs > standard > lang > support > ExpressionEvaluator


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache 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.apache.org/licenses/LICENSE-2.0
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
17 package org.apache.taglibs.standard.lang.support;
18
19 import javax.servlet.jsp.JspException JavaDoc;
20 import javax.servlet.jsp.PageContext JavaDoc;
21 import javax.servlet.jsp.tagext.Tag JavaDoc;
22
23 /**
24  * <p>The interface for an expression-language validator and evaluator.
25  * Classes that implement an expression language expose their functionality
26  * via this interface.</p>
27  *
28  * <p>The validate() and evaluate() methods must be thread-safe. That is,
29  * multiple threads may call these methods on the same ExpressionEvaluator
30  * object simultaneously. Implementations should synchronize access if
31  * they depend on transient state. Implementations should not, however,
32  * assume that only one object of each ExpressionEvaluator type will be
33  * instantiated; global caching should therefore be static. No release()
34  * mechanism or robust lifecycle is specified, for language-interpreter
35  * pluggability is experimental in EA2.</p>
36  *
37  * <p><b>WARNING</b>: This class supports experimentation for the EA2
38  * release of JSTL; it is not expected to be part of the final RI or
39  * specification.</p>
40  *
41  * @author Shawn Bayern (based exactly on rev1 draft)
42  */

43 public interface ExpressionEvaluator {
44
45     /**
46      * Translation time validation of an expression.
47      * This method will return a null String if the expression
48      * is valid; otherwise an error message.
49      */

50     public String JavaDoc validate(String JavaDoc attributeName,
51                            String JavaDoc expression);
52
53     /**
54      * Evaluates the expression at request time.
55      */

56     public Object JavaDoc evaluate(String JavaDoc attributeName,
57                            String JavaDoc expression,
58                            Class JavaDoc expectedType,
59                            Tag JavaDoc tag,
60                            PageContext JavaDoc pageContext)
61        throws JspException JavaDoc;
62 }
63
Popular Tags