KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jorm > metainfo > api > ClassMapping


1 /**
2  * JORM: an implementation of a generic mapping system for persistent Java
3  * objects. Two mapping are supported: to RDBMS and to binary files.
4  * Copyright (C) 2001-2003 France Telecom R&D - INRIA
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  * Contact: jorm-team@objectweb.org
21  *
22  */

23
24 package org.objectweb.jorm.metainfo.api;
25
26 import java.util.Iterator JavaDoc;
27 import java.util.Collection JavaDoc;
28
29 /**
30  * This interface gathers methods to the ClassMapping and GenClassMapping
31  * interfaces. It gives the notion of reference
32  * @author X. Spengler
33  */

34 public interface ClassMapping extends CommonClassMapping {
35
36     /**
37      *
38      * @return the JORM Class linked to the ClassMapping.
39      * This JORM class is also the linkedMO.
40      * The getLinkedMO() method returns a MetaObject and not a Class object.
41      */

42     public Class JavaDoc getJormClass();
43     
44     /**
45      * Adds a ReferenceMapping object.
46      *
47      * @param refMapping the ReferenceMapping object to add to the list.
48      */

49     void addReferenceMapping(ReferenceMapping refMapping);
50
51     /**
52      * Retrieves the ReferenceMapping instance corresponding to the name of
53      * a reference field.
54      * @param referenceName is the name of a reference field
55      * @return a ReferenceMapping instance or a null value if no mapping is
56      * defined for the reference name
57      */

58     ReferenceMapping getReferenceMapping(String JavaDoc referenceName);
59
60     /**
61      * Returns an Iterator over ReferenceMapping objects.
62      *
63      * @return an Iterator.
64      */

65     Iterator JavaDoc iterateReferenceMappings();
66
67     /**
68      * Returns a collection of ReferenceMapping objects.
69      *
70      * @return a collection.
71      */

72     Collection JavaDoc getReferenceMappings();
73
74     Collection JavaDoc getParentClassMappings();
75
76
77     ParentClassMapping getParentClassMapping(String JavaDoc className);
78
79     /**
80      * Creates a implicit parent class mapping. This method is called to create
81      * parent class mapping to super classes for which there is no parent class
82      * mapping defined, which means that an implicit inheritance rule of mapping
83      * should be applied. For example, with the rdb mapper, this implicit rule
84      * is to inherit all the mappings defined in the super class.
85      *
86      * @param superClass the super class that will be referenced by this
87      * parent class mapping
88      * @return a parent class mapping with in implicit rule to the super class
89      */

90     ParentClassMapping createImplicitParentClassMapping(Class JavaDoc superClass);
91
92     /**
93      * Get the primitive element mapping corresponding to a field name by searching
94      * recursively in the super classes until it is found (if requested)
95      * @param fieldName the name of the field of which the primitive element
96      * mapping must be returned
97      * @param searchInSuper if true search recursively in super classes
98      * @return the primitive element mapping if found, null otherwise
99      */

100     PrimitiveElementMapping getPrimitiveElementMapping(String JavaDoc fieldName,
101                                                        boolean searchInSuper);
102     /**
103      * Add implicit dependencies of mapping structure creation to mapping structure
104      * definition. For example, in the case of relational mappings, the creation
105      * of tables cannot be known until all the columns of the table is known and
106      * those columns may not be known until the mapping of super/sub classes
107      * is known.
108      */

109     void addImplicitDependencies();
110 }
111
Popular Tags