KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > jdo > query > ParamNode


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 package com.versant.core.jdo.query;
13
14 import com.versant.core.metadata.ClassMetaData;
15 import com.versant.core.common.Debug;
16
17 /**
18  * This node is created when the value of a parameter is required as part
19  * of an expression.
20  */

21 public class ParamNode extends LeafNode {
22
23     private String JavaDoc type;
24     private String JavaDoc identifier;
25     private Class JavaDoc cls;
26     private ClassMetaData cmd;
27     private Object JavaDoc value;
28     /**
29      * This is the index of the parameter in the declared parameter list.
30      */

31     private int index;
32
33     /**
34      * The store specific usage list for this node.
35      */

36     public Object JavaDoc usageList;
37
38     public ParamNode() {
39     }
40
41     public Object JavaDoc accept(NodeVisitor visitor, Object JavaDoc[] results) {
42       return visitor.visitParamNode(this, results);
43     }
44
45     public String JavaDoc toString() {
46         StringBuffer JavaDoc s = new StringBuffer JavaDoc();
47         s.append(super.toString());
48         s.append(' ');
49         if (cls != null) s.append(cls);
50         else s.append(type);
51         s.append(' ');
52         s.append(identifier);
53         s.append(" index ");
54         s.append(index);
55         return s.toString();
56     }
57
58     /**
59      * Resolve field refs and so on relative to the compiler. This must
60      * recursively resolve any child nodes.
61      */

62     public void resolve(QueryParser comp, ClassMetaData cmd, boolean ordering) {
63         if (Debug.DEBUG) System.out.println("### ParamNode.resolve " + this);
64         if (cls == null) cls = comp.resolveParamType(type);
65     }
66
67     public Field visit(MemVisitor visitor, Object JavaDoc obj) {
68         return visitor.visitParamNode(this, obj);
69     }
70
71     public String JavaDoc getType() {
72         return type;
73     }
74
75     public void setType(String JavaDoc type) {
76         this.type = type;
77     }
78
79     public String JavaDoc getIdentifier() {
80         return identifier;
81     }
82
83     public void setIdentifier(String JavaDoc identifier) {
84         this.identifier = identifier;
85     }
86
87     public Class JavaDoc getCls() {
88         return cls;
89     }
90
91     public void setCls(Class JavaDoc cls) {
92         this.cls = cls;
93     }
94
95     public ClassMetaData getCmd() {
96         return cmd;
97     }
98
99     public void setCmd(ClassMetaData cmd) {
100         this.cmd = cmd;
101     }
102
103     public Object JavaDoc getValue() {
104         return value;
105     }
106
107     public void setValue(Object JavaDoc value) {
108         this.value = value;
109     }
110
111     public int getIndex() {
112         return index;
113     }
114
115     public void setIndex(int index) {
116         this.index = index;
117     }
118
119     public Object JavaDoc getUsageList() {
120         return usageList;
121     }
122
123     public void clearSqlUsageList() {
124         usageList = null;
125     }
126
127     public Object JavaDoc arrive(NodeVisitor v, Object JavaDoc msg) {
128         return v.arriveParamNode(this, msg);
129     }
130
131 }
132
Popular Tags