KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > jdo > jdoql > LocalVariableAccess


1 package org.apache.ojb.jdo.jdoql;
2
3 /* Copyright 2003-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * 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 {
26     /** The accessed variable */
27     private LocalVariable _variable;
28
29     /**
30      * Creates a new variable access object.
31      *
32      * @param name The variable's name
33      */

34     public LocalVariableAccess(String JavaDoc name)
35     {
36         super(null, name);
37     }
38
39     /**
40      * Returns the accessed variable.
41      *
42      * @return The variable
43      */

44     public LocalVariable getAccessedVariable()
45     {
46         return _variable;
47     }
48     
49     /**
50      * Sets the accessed variable.
51      *
52      * @param variable The variable
53      */

54     public void setAccessedVariable(LocalVariable variable)
55     {
56         _variable = variable;
57     }
58     
59     /* (non-Javadoc)
60      * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
61      */

62     public void accept(Visitor visitor)
63     {
64         visitor.visit(this);
65     }
66
67     /* (non-Javadoc)
68      * @see org.apache.ojb.jdo.jdoql.Expression#getType()
69      */

70     public Class JavaDoc getType()
71     {
72         return _variable.getType().getType();
73     }
74 }
75
Popular Tags