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: * The 'null' literal.
20: *
21: * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
22: */
23: public class NullLiteral extends Expression {
24: /** The type of this null literal */
25: private Class _type = Object.class;
26:
27: /**
28: * Creates a new null literal object.
29: */
30: public NullLiteral() {
31: }
32:
33: /* (non-Javadoc)
34: * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
35: */
36: public void accept(Visitor visitor) {
37: visitor.visit(this );
38: }
39:
40: /* (non-Javadoc)
41: * @see java.lang.Object#toString()
42: */
43: public String toString() {
44: return "null";
45: }
46:
47: /**
48: * Sets the type of this null literal. The type depends on the context
49: * of the literal, e.g. in a binary expression where the other side
50: * is of type string, this literal would also have type string.
51: *
52: * @param type The type
53: */
54: public void setType(Class type) {
55: _type = type;
56: }
57:
58: /* (non-Javadoc)
59: * @see org.apache.ojb.jdo.jdoql.Expression#getType()
60: */
61: public Class getType() {
62: return _type;
63: }
64: }
|