KickJava   Java API By Example, From Geeks To Geeks.

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


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
28 /**
29  * The NameDef interface describes the mapping of a reference field,
30  * ut can be the PName of a Class. It can be a Field which is an attribute
31  * of the class and is a reference; in this case, the reference can be
32  * to another Class (ClassObject) or to a GenClass.
33  * A NameDef object is composed of ScalarField(s) and/or FieldName(s),
34  * or system defined.
35  * @author X. Spengler
36  */

37 public interface NameDef extends MetaObject {
38
39     /**
40      * Allows to know if the namedef is describe by a composite name.
41      * @return true the namedef is a composite one.
42      */

43     boolean isNameRef();
44
45     /**
46      * Allows to know if the namedef is describe by a single field.
47      * @return true the namedef is a single one.
48      */

49     boolean isFieldName();
50
51     /**
52      * Builds a reference toward a composite name describing the namedef.
53      * @param cn_Class the meta object representing the composite name.
54      * @return the nameref metaobject describing the reference.
55      */

56     NameRef createNameRef(CompositeName cn_Class);
57
58     /**
59      * Retrieves the nameref if the namedef is a composite one.
60      * @return the nameref or null if the namedef is a single one or system.
61      */

62     NameRef getNameRef();
63
64     /**
65      * Retrieves the name of the field describing the namedef.
66      * The fieldname can be the name of a field or an hiddenfield.
67      * @return the fieldname or null is the namedef is a system or a composite one.
68      */

69     String JavaDoc getFieldName();
70
71     /**
72      * Allows to set the fieldname describing the namedef single field.
73      * @param fieldname the fieldname
74      */

75     void setFieldName(String JavaDoc fieldname);
76
77     /**
78      * Returns the name of the NameDef object.
79      * @return the name of the NameDef object.
80      */

81     public String JavaDoc getName();
82
83     /**
84      * Sets the name of the NameDef object.
85      * @param name the name of the NameDef object.
86      */

87     public void setName(String JavaDoc name);
88
89     /**
90      * Allows to know if the mapping of the referenced field is defined by
91      * another system (could be defined by Versant system for instance).
92      * @return true, if the mapping is defined by another system, else false,
93      * if the mapping is defined inside JORM (by ScalarField(s) and
94      * FieldName(s)).
95      */

96     boolean isSystem();
97
98     /**
99      * Allows to set if the current NameDef is system defined (defined outside
100      * jorm) or not.
101      * @param system true, if the mapping is defined by another system, else
102      * false, if the mapping is defined inside JORM (by
103      * ScalarField(s) and FieldName(s)).
104      */

105     void setSystem(boolean system);
106
107     /**
108      * Returns the number of fields which composed the current object.
109      * these fields are hidden or not
110      * @return the number of fields
111      */

112     int getFieldNumber();
113
114     /**
115      * Returns an iterator on all fields (HiddenFields and FieldRef).
116      * This iterator contains FieldName . If no object
117      * fields exists, an empty iterator is returned.
118      * @return an iterator on field
119      */

120     Iterator JavaDoc iterateField();
121
122 }
123
Popular Tags