01: package org.apache.ojb.jdo.jdoql;
02:
03: /* Copyright 2003-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /**
19: * A local variable access expression. Note that this expression type can only be
20: * present in a query tree after resolving it.
21: *
22: * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
23: */
24: public class LocalVariableAccess extends NameExpression {
25: /** The accessed variable */
26: private LocalVariable _variable;
27:
28: /**
29: * Creates a new variable access object.
30: *
31: * @param name The variable's name
32: */
33: public LocalVariableAccess(String name) {
34: super (null, name);
35: }
36:
37: /**
38: * Returns the accessed variable.
39: *
40: * @return The variable
41: */
42: public LocalVariable getAccessedVariable() {
43: return _variable;
44: }
45:
46: /**
47: * Sets the accessed variable.
48: *
49: * @param variable The variable
50: */
51: public void setAccessedVariable(LocalVariable variable) {
52: _variable = variable;
53: }
54:
55: /* (non-Javadoc)
56: * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
57: */
58: public void accept(Visitor visitor) {
59: visitor.visit(this );
60: }
61:
62: /* (non-Javadoc)
63: * @see org.apache.ojb.jdo.jdoql.Expression#getType()
64: */
65: public Class getType() {
66: return _variable.getType().getType();
67: }
68: }
|