KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > triactive > jdo > store > ObjectLiteral


1 /*
2  * Copyright 2002 (C) TJDO.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the TJDO License version 1.0.
6  * See the terms of the TJDO License in the documentation provided with this software.
7  *
8  * $Id: ObjectLiteral.java,v 1.3 2003/08/04 16:40:35 pierreg0 Exp $
9  */

10
11 package com.triactive.jdo.store;
12
13
14 class ObjectLiteral extends ObjectExpression
15 {
16     private Object JavaDoc value;
17
18     public ObjectLiteral(QueryStatement qs, ColumnMapping m, Object JavaDoc value)
19     {
20     super(qs);
21
22         st.appendParameter(m, value);
23         this.value = value;
24     }
25
26     public BooleanExpression eq(SQLExpression expr)
27     {
28         if (expr instanceof ObjectLiteral)
29             return new BooleanLiteral(qs, value.equals(((ObjectLiteral)expr).value));
30         else
31             return super.eq(expr);
32     }
33
34     public BooleanExpression noteq(SQLExpression expr)
35     {
36         if (expr instanceof ObjectLiteral)
37             return new BooleanLiteral(qs, !value.equals(((ObjectLiteral)expr).value));
38         else
39             return super.noteq(expr);
40     }
41
42     public String JavaDoc toString()
43     {
44         return super.toString() + " = " + value.toString();
45     }
46 }
47
Popular Tags