01: /**********************************************************************
02: Copyright (c) 2004 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: 2004 Andy Jefferson - added discriminator constant
18: ...
19: **********************************************************************/package org.jpox.store.mapping;
20:
21: import org.jpox.metadata.AbstractMemberMetaData;
22: import org.jpox.store.DatastoreField;
23:
24: /**
25: * Consumer of mappings.
26: * @version $Revision: 1.10 $
27: */
28: public interface MappingConsumer {
29: /** mapping a field representing the version of a PC **/
30: public static int MAPPING_TYPE_VERSION = 1;
31:
32: /** mapping a field representing the id of a PC **/
33: public static int MAPPING_TYPE_DATASTORE_ID = 2;
34:
35: /** mapping a field representing the discriminator of a PC **/
36: public static int MAPPING_TYPE_DISCRIMINATOR = 3;
37:
38: /** mapping a datastore column that is an index for an external list. */
39: public static int MAPPING_TYPE_EXTERNAL_INDEX = 4;
40:
41: /** mapping a datastore column that is a FK for an external collection. */
42: public static int MAPPING_TYPE_EXTERNAL_FK = 5;
43:
44: /** mapping a datastore column that is the discriminator for a FK for an external collection. */
45: public static int MAPPING_TYPE_EXTERNAL_FK_DISCRIM = 6;
46:
47: /**
48: * This method is called before consuming the mappings
49: * @param highestFieldNumber the highest number for the fields that are going to be provided in the consumer
50: */
51: void preConsumeMapping(int highestFieldNumber);
52:
53: /**
54: * Consumes a mapping associated to a field
55: * @param m The Java type mapping
56: * @param fmd Field MetaData for the field
57: */
58: void consumeMapping(JavaTypeMapping m, AbstractMemberMetaData fmd);
59:
60: /**
61: * Consumes a mapping not associated to a field
62: * @param m Java type mapping
63: * @param mappingType the Mapping type
64: */
65: void consumeMapping(JavaTypeMapping m, int mappingType);
66:
67: /**
68: * Consumer a datastore field without mapping.
69: * @param fld The datastore field
70: */
71: void consumeUnmappedDatastoreField(DatastoreField fld);
72: }
|