KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cayenne > ejbql > EJBQLExpressionVisitor


1 /*****************************************************************
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  ****************************************************************/

19 package org.apache.cayenne.ejbql;
20
21 import org.apache.cayenne.ejbql.parser.EJBQLAggregateColumn;
22 import org.apache.cayenne.ejbql.parser.EJBQLFromItem;
23 import org.apache.cayenne.ejbql.parser.EJBQLJoin;
24 import org.apache.cayenne.ejbql.parser.EJBQLPath;
25 import org.apache.cayenne.ejbql.parser.EJBQLPositionalInputParameter;
26
27 /**
28  * A visitor interface to inspect the EJBQL expression tree. Visit methods return
29  * booleans, indicating whether the children of a given node should be visited.
30  *
31  * @since 3.0
32  * @author Andrus Adamchik
33  */

34 public interface EJBQLExpressionVisitor {
35
36     boolean visitAbs(EJBQLExpression expression);
37
38     boolean visitAbstractSchemaName(EJBQLExpression expression);
39
40     /**
41      * Called on visiting "add" expression and also after visiting every expression child.
42      *
43      * @param expression an "add" node being visited.
44      * @param finishedChildIndex "-1" when the expression node is visited for the first
45      * time, before its children; otherwise this is an index of a child just
46      * visited.
47      */

48     boolean visitAdd(EJBQLExpression expression, int finishedChildIndex);
49
50     boolean visitAggregate(EJBQLExpression expression);
51
52     boolean visitAll(EJBQLExpression expression);
53
54     /**
55      * Called on visiting "and" expression and also after visiting every expression child.
56      *
57      * @param expression an "and" node being visited.
58      * @param finishedChildIndex "-1" when the expression node is visited for the first
59      * time, before its children; otherwise this is an index of a child just
60      * visited.
61      */

62     boolean visitAnd(EJBQLExpression expression, int finishedChildIndex);
63
64     boolean visitAny(EJBQLExpression expression);
65
66     boolean visitAscending(EJBQLExpression expression);
67
68     boolean visitAverage(EJBQLAggregateColumn expression);
69
70     /**
71      * Called on visiting "between" expression and also after visiting every expression
72      * child.
73      *
74      * @param expression an "between" node being visited.
75      * @param finishedChildIndex "-1" when the expression node is visited for the first
76      * time, before its children; otherwise this is an index of a child just
77      * visited.
78      */

79     boolean visitBetween(EJBQLExpression expression, int finishedChildIndex);
80
81     boolean visitBooleanLiteral(EJBQLExpression expression);
82
83     boolean visitClassName(EJBQLExpression expression);
84
85     boolean visitConcat(EJBQLExpression expression);
86
87     boolean visitConstructor(EJBQLExpression expression);
88
89     boolean visitConstructorParameter(EJBQLExpression expression);
90
91     boolean visitConstructorParameters(EJBQLExpression expression);
92
93     boolean visitCount(EJBQLAggregateColumn expression);
94
95     boolean visitCurrentDate(EJBQLExpression expression);
96
97     boolean visitCurrentTime(EJBQLExpression expression);
98
99     boolean visitCurrentTimestamp(EJBQLExpression expression);
100
101     boolean visitDecimalLiteral(EJBQLExpression expression);
102
103     boolean visitDelete(EJBQLExpression expression);
104
105     boolean visitDescending(EJBQLExpression expression);
106
107     boolean visitDistinct(EJBQLExpression expression);
108
109     /**
110      * Called on visiting "divide" expression and also after visiting every expression
111      * child.
112      *
113      * @param expression an "divide" node being visited.
114      * @param finishedChildIndex "-1" when the expression node is visited for the first
115      * time, before its children; otherwise this is an index of a child just
116      * visited.
117      */

118     boolean visitDivide(EJBQLExpression expression, int finishedChildIndex);
119
120     /**
121      * Called on visiting "equals" expression and also after visiting every expression
122      * child.
123      *
124      * @param expression an "equals" node being visited.
125      * @param finishedChildIndex "-1" when the expression node is visited for the first
126      * time, before its children; otherwise this is an index of a child just
127      * visited.
128      */

129     boolean visitEquals(EJBQLExpression expression, int finishedChildIndex);
130
131     boolean visitEscapeCharacter(EJBQLExpression expression);
132
133     boolean visitExists(EJBQLExpression expression);
134
135     boolean visitFrom(EJBQLExpression expression, int finishedChildIndex);
136
137     boolean visitFromItem(EJBQLFromItem expression);
138
139     /**
140      * Called on visiting ">=" expression and also after visiting every expression child.
141      *
142      * @param expression an ">=" node being visited.
143      * @param finishedChildIndex "-1" when the expression node is visited for the first
144      * time, before its children; otherwise this is an index of a child just
145      * visited.
146      */

147     boolean visitGreaterOrEqual(EJBQLExpression expression, int finishedChildIndex);
148
149     /**
150      * Called on visiting ">=" expression and also after visiting every expression child.
151      *
152      * @param expression an ">=" node being visited.
153      * @param finishedChildIndex "-1" when the expression node is visited for the first
154      * time, before its children; otherwise this is an index of a child just
155      * visited.
156      */

157     boolean visitGreaterThan(EJBQLExpression expression, int finishedChildIndex);
158
159     boolean visitGroupBy(EJBQLExpression expression);
160
161     boolean visitHaving(EJBQLExpression expression);
162
163     boolean visitIdentificationVariable(EJBQLExpression expression);
164
165     boolean visitIdentifier(EJBQLExpression expression);
166
167     boolean visitIn(EJBQLExpression expression);
168
169     boolean visitInnerFetchJoin(EJBQLJoin join);
170
171     boolean visitInnerJoin(EJBQLJoin join);
172
173     boolean visitIntegerLiteral(EJBQLExpression expression);
174
175     boolean visitIsEmpty(EJBQLExpression expression);
176
177     boolean visitIsNull(EJBQLExpression expression, int finishedChildIndex);
178
179     boolean visitLength(EJBQLExpression expression);
180
181     /**
182      * Called on visiting "<=" expression and also after visiting every expression child.
183      *
184      * @param expression an "<=" node being visited.
185      * @param finishedChildIndex "-1" when the expression node is visited for the first
186      * time, before its children; otherwise this is an index of a child just
187      * visited.
188      */

189     boolean visitLessOrEqual(EJBQLExpression expression, int finishedChildIndex);
190
191     /**
192      * Called on visiting "<" expression and also after visiting every expression child.
193      *
194      * @param expression an "<" node being visited.
195      * @param finishedChildIndex "-1" when the expression node is visited for the first
196      * time, before its children; otherwise this is an index of a child just
197      * visited.
198      */

199     boolean visitLessThan(EJBQLExpression expression, int finishedChildIndex);
200
201     /**
202      * Called on visiting "LIKE" expression and also after visiting every expression
203      * child.
204      *
205      * @param expression an "LIKE" node being visited.
206      * @param finishedChildIndex "-1" when the expression node is visited for the first
207      * time, before its children; otherwise this is an index of a child just
208      * visited.
209      */

210     boolean visitLike(EJBQLExpression expression, int finishedChildIndex);
211
212     boolean visitLocate(EJBQLExpression expression);
213
214     boolean visitLower(EJBQLExpression expression);
215
216     boolean visitMax(EJBQLAggregateColumn expression);
217
218     boolean visitMemberOf(EJBQLExpression expression);
219
220     boolean visitMin(EJBQLAggregateColumn expression);
221
222     boolean visitMod(EJBQLExpression expression);
223
224     /**
225      * Called on visiting "*" expression and also after visiting every expression child.
226      *
227      * @param expression an "*" node being visited.
228      * @param finishedChildIndex "-1" when the expression node is visited for the first
229      * time, before its children; otherwise this is an index of a child just
230      * visited.
231      */

232     boolean visitMultiply(EJBQLExpression expression, int finishedChildIndex);
233
234     boolean visitNamedInputParameter(EJBQLExpression expression);
235
236     boolean visitNegative(EJBQLExpression expression);
237
238     boolean visitNot(EJBQLExpression expression);
239
240     /**
241      * Called on visiting "!=" expression and also after visiting every expression child.
242      *
243      * @param expression an "!=" node being visited.
244      * @param finishedChildIndex "-1" when the expression node is visited for the first
245      * time, before its children; otherwise this is an index of a child just
246      * visited.
247      */

248     boolean visitNotEquals(EJBQLExpression expression, int finishedChildIndex);
249
250     /**
251      * Called on visiting "or" expression and also after visiting every expression child.
252      *
253      * @param expression an "or" node being visited.
254      * @param finishedChildIndex "-1" when the expression node is visited for the first
255      * time, before its children; otherwise this is an index of a child just
256      * visited.
257      */

258     boolean visitOr(EJBQLExpression expression, int finishedChildIndex);
259
260     boolean visitOrderBy(EJBQLExpression expression);
261
262     boolean visitOrderByItem(EJBQLExpression expression);
263
264     boolean visitOuterFetchJoin(EJBQLJoin join);
265
266     boolean visitOuterJoin(EJBQLJoin join);
267
268     /**
269      * Called on visiting "path" expression and also after visiting every expression
270      * child.
271      *
272      * @param expression a "path" node being visited.
273      * @param finishedChildIndex "-1" when the expression node is visited for the first
274      * time, before its children; otherwise this is an index of a child just
275      * visited.
276      */

277     boolean visitPath(EJBQLPath expression, int finishedChildIndex);
278
279     boolean visitPatternValue(EJBQLExpression expression);
280
281     boolean visitPositionalInputParameter(EJBQLPositionalInputParameter expression);
282
283     boolean visitSelect(EJBQLExpression expression);
284
285     boolean visitSelectExpression(EJBQLExpression expression);
286
287     boolean visitSelectExpressions(EJBQLExpression expression);
288
289     boolean visitSize(EJBQLExpression expression);
290
291     boolean visitSqrt(EJBQLExpression expression);
292
293     boolean visitStringLiteral(EJBQLExpression expression);
294
295     boolean visitSubselect(EJBQLExpression expression);
296
297     boolean visitSubstring(EJBQLExpression expression);
298
299     /**
300      * Called on visiting "subtract" expression and also after visiting every expression
301      * child.
302      *
303      * @param expression an "subtract" node being visited.
304      * @param finishedChildIndex "-1" when the expression node is visited for the first
305      * time, before its children; otherwise this is an index of a child just
306      * visited.
307      */

308     boolean visitSubtract(EJBQLExpression expression, int finishedChildIndex);
309
310     boolean visitSum(EJBQLAggregateColumn expression);
311
312     boolean visitTok(EJBQLExpression expression);
313
314     boolean visitTrim(EJBQLExpression expression);
315
316     boolean visitTrimBoth(EJBQLExpression expression);
317
318     boolean visitTrimCharacter(EJBQLExpression expression);
319
320     boolean visitTrimLeading(EJBQLExpression expression);
321
322     boolean visitTrimTrailing(EJBQLExpression expression);
323
324     boolean visitUpdate(EJBQLExpression expression);
325
326     boolean visitUpdateField(EJBQLExpression expression);
327
328     boolean visitUpdateItem(EJBQLExpression expression);
329
330     boolean visitUpdateValue(EJBQLExpression expression);
331
332     boolean visitUpper(EJBQLExpression expression);
333
334     boolean visitWhere(EJBQLExpression expression);
335 }
336
Popular Tags