01: /**********************************************************************
02: Copyright (c) 2005 Andy Jefferson 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.ClassNameConstants;
22:
23: /**
24: * Mapping for Object fields.
25: * An Object field can represent two things
26: * <ol>
27: * <li>An object of a series of possible PC types ("implementation-classes") and each implementation type is
28: * represented in the datastore by a FK to the PC table</li>
29: * <li>An object of a series of possible non-PC types (e.g String, Long, Double etc) and each implementation type
30: * is represented in the datastore by a separate column</li>
31: * </ol>
32: *
33: * @version $Revision: 1.17 $
34: */
35: public class ObjectMapping extends ReferenceMapping {
36: /**
37: * Accessor for the Java type being represented.
38: * @return java.lang.Object
39: */
40: public Class getJavaType() {
41: return Object.class;
42: }
43:
44: /**
45: * Accessor for the name of the java-type actually used when mapping the particular datastore
46: * field. Returns Serializable since the object needs to be serialisable
47: * @param index requested datastore field index.
48: * @return the name of java-type for the requested datastore field.
49: */
50: public String getJavaTypeForDatastoreMapping(int index) {
51: return ClassNameConstants.JAVA_IO_SERIALIZABLE;
52: }
53:
54: /**
55: * Accessor for a sample value for this Java type
56: * @return The sample value
57: */
58: public Object getSampleValue(ClassLoaderResolver clr) {
59: return null;
60: }
61: }
|