01: /*
02: * Copyright 2006, 2007 Odysseus Software GmbH
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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 de.odysseus.el.tree.impl.ast;
17:
18: import javax.el.ELContext;
19: import javax.el.ELException;
20: import javax.el.MethodInfo;
21:
22: import de.odysseus.el.misc.LocalMessages;
23: import de.odysseus.el.tree.Bindings;
24:
25: /**
26: * @author Christoph Beck
27: */
28: public abstract class AstRightValue extends AstNode {
29: /**
30: * Answer <code>false</code>
31: */
32: public final boolean isLiteralText() {
33: return false;
34: }
35:
36: /**
37: * according to the spec, the result is undefined for rvalues, so answer <code>null</code>
38: */
39: public final Class<?> getType(Bindings bindings, ELContext context) {
40: return null;
41: }
42:
43: /**
44: * non-lvalues are always readonly, so answer <code>true</code>
45: */
46: public final boolean isReadOnly(Bindings bindings, ELContext context) {
47: return true;
48: }
49:
50: /**
51: * non-lvalues are always readonly, so throw an exception
52: */
53: public final void setValue(Bindings bindings, ELContext context,
54: Object value) {
55: throw new ELException(LocalMessages
56: .get("error.value.set.rvalue"));
57: }
58:
59: public final MethodInfo getMethodInfo(Bindings bindings,
60: ELContext context, Class returnType, Class[] paramTypes) {
61: return null;
62: }
63:
64: public final Object invoke(Bindings bindings, ELContext context,
65: Class returnType, Class[] paramTypes, Object[] paramValues) {
66: throw new ELException(LocalMessages.get("error.method.invalid",
67: getStructuralId(bindings)));
68: }
69:
70: public final boolean isLeftValue() {
71: return false;
72: }
73: }
|