KickJava   Java API By Example, From Geeks To Geeks.

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


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 literal.
20  *
21  * @author <a HREF="mailto:tomdz@apache.org">Thomas Dudziak</a>
22  */

23 public class Literal extends Expression
24 {
25     /** The type of the literal */
26     private Class JavaDoc _type;
27     /** The textual representation */
28     private String JavaDoc _textRep;
29
30     /**
31      * Creates a new literal object.
32      *
33      * @param type The type of the literal
34      * @param textRep The textual representation
35      */

36     public Literal(Class JavaDoc type, String JavaDoc textRep)
37     {
38         _type = type;
39         _textRep = textRep;
40     }
41
42     /**
43      * Returns the (original) textual representation.
44      *
45      * @return The text
46      */

47     public String JavaDoc getTextRepresentation()
48     {
49         return _textRep;
50     }
51
52     /* (non-Javadoc)
53      * @see org.apache.ojb.jdo.jdoql.Expression#getType()
54      */

55     public Class JavaDoc getType()
56     {
57         return _type;
58     }
59
60     /* (non-Javadoc)
61      * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
62      */

63     public void accept(Visitor visitor)
64     {
65         visitor.visit(this);
66     }
67
68     /* (non-Javadoc)
69      * @see java.lang.Object#toString()
70      */

71     public String JavaDoc toString()
72     {
73         return _textRep;
74     }
75 }
76
Popular Tags