01: /**********************************************************************
02: Copyright (c) 2002 Mike Martin (TJDO) and others. All rights reserved.
03: Licensed under the Apache License, Version 2.0 (the "License");
04: you may not use this file except in compliance with the License.
05: You may obtain a copy of the License at
06:
07: http://www.apache.org/licenses/LICENSE-2.0
08:
09: Unless required by applicable law or agreed to in writing, software
10: distributed under the License is distributed on an "AS IS" BASIS,
11: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: See the License for the specific language governing permissions and
13: limitations under the License.
14:
15: Contributors:
16: 2003 Andy Jefferson - coding standards
17: ...
18: **********************************************************************/package org.jpox.store.expression;
19:
20: import java.sql.Timestamp;
21:
22: import org.jpox.store.mapping.JavaTypeMapping;
23:
24: /**
25: * Representation of an SQLTimestamp literal in a Query.
26: *
27: * @version $Revision: 1.5 $
28: **/
29: public class SqlTimestampLiteral extends SqlTemporalExpression
30: implements Literal {
31: private final Timestamp value;
32:
33: /** Raw value that this literal represents. */
34: Object rawValue;
35:
36: /**
37: * Creates a java.sql.Timestamp literal
38: * @param qs the QueryExpression
39: * @param mapping the mapping
40: * @param value the java.sql.Timestamp value
41: */
42: public SqlTimestampLiteral(QueryExpression qs,
43: JavaTypeMapping mapping, Timestamp value) {
44: super (qs);
45: this .mapping = mapping;
46: this .value = value;
47: st.appendParameter(mapping, value);
48: }
49:
50: public String toString() {
51: return super .toString() + " = " + value.toString();
52: }
53:
54: public Object getValue() {
55: return value;
56: }
57:
58: /**
59: * Method to save a "raw" value that this literal represents.
60: * This value differs from the literal value since that is of the same type as this literal.
61: * @param val The raw value
62: */
63: public void setRawValue(Object val) {
64: this .rawValue = val;
65: }
66:
67: /**
68: * Accessor for the "raw" value that this literal represents.
69: * This value differs from the literal value since that is of the same type as this literal.
70: * @return The raw value
71: */
72: public Object getRawValue() {
73: return rawValue;
74: }
75: }
|