5
5
* The ASF licenses this file to You under the Apache License, Version 2.0
6
6
* (the "License"); you may not use this file except in compliance with
7
7
* the License. You may obtain a copy of the License at
9
9
* http://www.apache.org/licenses/LICENSE-2.0
11
11
* Unless required by applicable law or agreed to in writing, software
12
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
44
44
* An <code>Expression</code> that refers to a method on an object.
47
47
* <code>The {@link ExpressionFactory#createMethodExpression} method
48
48
* can be used to parse an expression string and return a concrete instance
49
49
* of <code>MethodExpression</code> that encapsulates the parsed expression.
50
* The {@link FunctionMapper} is used at parse time, not evaluation time,
51
* so one is not needed to evaluate an expression using this class.
50
* The {@link FunctionMapper} is used at parse time, not evaluation time,
51
* so one is not needed to evaluate an expression using this class.
52
52
* However, the {@link ELContext} is needed at evaluation time.</p>
54
* <p>The {@link #getMethodInfo} and {@link #invoke} methods will evaluate the
55
* expression each time they are called. The {@link ELResolver} in the
56
* <code>ELContext</code> is used to resolve the top-level variables and to
57
* determine the behavior of the <code>.</code> and <code>[]</code>
58
* operators. For any of the two methods, the {@link ELResolver#getValue}
59
* method is used to resolve all properties up to but excluding the last
54
* <p>The {@link #getMethodInfo} and {@link #invoke} methods will evaluate the
55
* expression each time they are called. The {@link ELResolver} in the
56
* <code>ELContext</code> is used to resolve the top-level variables and to
57
* determine the behavior of the <code>.</code> and <code>[]</code>
58
* operators. For any of the two methods, the {@link ELResolver#getValue}
59
* method is used to resolve all properties up to but excluding the last
60
60
* one. This provides the <code>base</code> object on which the method
61
* appears. If the <code>base</code> object is null, a
62
* <code>NullPointerException</code> must be thrown. At the last resolution,
61
* appears. If the <code>base</code> object is null, a
62
* <code>NullPointerException</code> must be thrown. At the last resolution,
63
63
* the final <code>property</code> is then coerced to a <code>String</code>,
64
* which provides the name of the method to be found. A method matching the
65
* name and expected parameters provided at parse time is found and it is
64
* which provides the name of the method to be found. A method matching the
65
* name and expected parameters provided at parse time is found and it is
66
66
* either queried or invoked (depending on the method called on this
67
67
* <code>MethodExpression</code>).</p>
69
* <p>See the notes about comparison, serialization and immutability in
69
* <p>See the notes about comparison, serialization and immutability in
70
70
* the {@link Expression} javadocs.
72
72
* @see javax.el.ELResolver
73
73
* @see javax.el.Expression
74
74
* @see javax.el.ExpressionFactory
75
75
* @see javax.el.MethodExpression
77
77
* @author Jacob Hookom [jacob@hookom.net]
78
* @version $Id: MethodExpressionImpl.java 939519 2010-04-30 00:12:23Z kkolinko $
80
80
public final class MethodExpressionImpl extends MethodExpression implements
154
154
* Returns the original String used to create this <code>Expression</code>,
158
158
* This is used for debugging purposes but also for the purposes of
159
159
* comparison (e.g. to ensure the expression in a configuration file has not
164
164
* This method does not provide sufficient information to re-create an
165
165
* expression. Two different expressions can have exactly the same
166
166
* expression string but different function mappings. Serialization should
167
167
* be used to save and restore the state of an <code>Expression</code>.
170
170
* @return The original expression String.
172
172
* @see javax.el.Expression#getExpressionString()
174
174
public String getExpressionString() {