01: /*
02: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
03: *
04: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
05: *
06: * Portions Copyright Apache Software Foundation.
07: *
08: * The contents of this file are subject to the terms of either the GNU
09: * General Public License Version 2 only ("GPL") or the Common Development
10: * and Distribution License("CDDL") (collectively, the "License"). You
11: * may not use this file except in compliance with the License. You can obtain
12: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
13: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
14: * language governing permissions and limitations under the License.
15: *
16: * When distributing the software, include this License Header Notice in each
17: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
18: * Sun designates this particular file as subject to the "Classpath" exception
19: * as provided by Sun in the GPL Version 2 section of the License file that
20: * accompanied this code. If applicable, add the following below the License
21: * Header, with the fields enclosed by brackets [] replaced by your own
22: * identifying information: "Portions Copyrighted [year]
23: * [name of copyright owner]"
24: *
25: * Contributor(s):
26: *
27: * If you wish your version of this file to be governed by only the CDDL or
28: * only the GPL Version 2, indicate your decision by adding "[Contributor]
29: * elects to include this software in this distribution under the [CDDL or GPL
30: * Version 2] license." If you don't indicate a single choice of license, a
31: * recipient has the option to distribute your version of this file under
32: * either the CDDL, the GPL Version 2 or to extend the choice of license to
33: * its licensees as provided above. However, if you add GPL Version 2 code
34: * and therefore, elected the GPL Version 2 license, then the option applies
35: * only if the new code is made subject to such option by the copyright
36: * holder.
37: */
38:
39: package org.apache.taglibs.standard.lang.support;
40:
41: import javax.servlet.jsp.JspException;
42: import javax.servlet.jsp.PageContext;
43: import javax.servlet.jsp.tagext.Tag;
44:
45: /**
46: * <p>The interface for an expression-language validator and evaluator.
47: * Classes that implement an expression language expose their functionality
48: * via this interface.</p>
49: *
50: * <p>The validate() and evaluate() methods must be thread-safe. That is,
51: * multiple threads may call these methods on the same ExpressionEvaluator
52: * object simultaneously. Implementations should synchronize access if
53: * they depend on transient state. Implementations should not, however,
54: * assume that only one object of each ExpressionEvaluator type will be
55: * instantiated; global caching should therefore be static. No release()
56: * mechanism or robust lifecycle is specified, for language-interpreter
57: * pluggability is experimental in EA2.</p>
58: *
59: * <p><b>WARNING</b>: This class supports experimentation for the EA2
60: * release of JSTL; it is not expected to be part of the final RI or
61: * specification.</p>
62: *
63: * @author Shawn Bayern (based exactly on rev1 draft)
64: */
65: public interface ExpressionEvaluator {
66:
67: /**
68: * Translation time validation of an expression.
69: * This method will return a null String if the expression
70: * is valid; otherwise an error message.
71: */
72: public String validate(String attributeName, String expression);
73:
74: /**
75: * Evaluates the expression at request time.
76: */
77: public Object evaluate(String attributeName, String expression,
78: Class expectedType, Tag tag, PageContext pageContext)
79: throws JspException;
80: }
|