01: /**********************************************************************
02: Copyright (c) 2006 Erik Bengtson 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:
16: Contributors:
17: ...
18: **********************************************************************/package org.jpox.store.mapping;
19:
20: import org.jpox.ClassLoaderResolver;
21: import org.jpox.ObjectManager;
22: import org.jpox.store.DatastoreAdapter;
23: import org.jpox.store.expression.NullLiteral;
24: import org.jpox.store.expression.QueryExpression;
25: import org.jpox.store.expression.ScalarExpression;
26: import org.jpox.store.expression.LogicSetExpression;
27:
28: /**
29: * Simple mapping for a null literal. Only used when the type
30: * is not determined
31: * @version $Revision: 1.7 $
32: **/
33: public class NullMapping extends SingleFieldMapping {
34:
35: public NullMapping(DatastoreAdapter dba) {
36: initialize(dba, null);
37: }
38:
39: public Class getJavaType() {
40: return null;
41: }
42:
43: public Object getSampleValue(ClassLoaderResolver clr) {
44: return null;
45: }
46:
47: public Object getObject(ObjectManager om, Object resultSet,
48: int[] exprIndex) {
49: return null;
50: }
51:
52: public void setObject(ObjectManager om, Object preparedStatement,
53: int[] exprIndex, Object value) {
54: }
55:
56: public ScalarExpression newLiteral(QueryExpression qs, Object value) {
57: return new NullLiteral(qs);
58: }
59:
60: public ScalarExpression newScalarExpression(QueryExpression qs,
61: LogicSetExpression te) {
62: return new NullLiteral(qs);
63: }
64: }
|