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 literal.
20: *
21: * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
22: */
23: public class Literal extends Expression {
24: /** The type of the literal */
25: private Class _type;
26: /** The textual representation */
27: private String _textRep;
28:
29: /**
30: * Creates a new literal object.
31: *
32: * @param type The type of the literal
33: * @param textRep The textual representation
34: */
35: public Literal(Class type, String textRep) {
36: _type = type;
37: _textRep = textRep;
38: }
39:
40: /**
41: * Returns the (original) textual representation.
42: *
43: * @return The text
44: */
45: public String getTextRepresentation() {
46: return _textRep;
47: }
48:
49: /* (non-Javadoc)
50: * @see org.apache.ojb.jdo.jdoql.Expression#getType()
51: */
52: public Class getType() {
53: return _type;
54: }
55:
56: /* (non-Javadoc)
57: * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
58: */
59: public void accept(Visitor visitor) {
60: visitor.visit(this );
61: }
62:
63: /* (non-Javadoc)
64: * @see java.lang.Object#toString()
65: */
66: public String toString() {
67: return _textRep;
68: }
69: }
|