View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package javax.jdo.metadata;
18  
19  import java.lang.reflect.Method;
20  
21  import javax.jdo.annotations.IdentityType;
22  
23  /**
24   * Represents a class or interface. Extended for the specifics of those cases.
25   * @since 3.0
26   */
27  public interface TypeMetadata extends Metadata {
28      /**
29       * Accessor for the name of this component (set on construction).
30       * 
31       * @return The name
32       */
33      String getName();
34  
35      /**
36       * Method to define the identity type to use.
37       * 
38       * @param id identity type
39       */
40      TypeMetadata setIdentityType(IdentityType id);
41  
42      /**
43       * Accessor for the identity type to use.
44       * 
45       * @return identity type
46       */
47      IdentityType getIdentityType();
48  
49      /**
50       * Method to set the object-id (PK) class.
51       * 
52       * @param idclass Object-id class
53       */
54      TypeMetadata setObjectIdClass(String idclass);
55  
56      /**
57       * Accessor for the object-id class (if defined).
58       * 
59       * @return The object-id class
60       */
61      String getObjectIdClass();
62  
63      /**
64       * Method to set whether the component requires an extent.
65       * 
66       * @param extent Requires extent?
67       */
68      TypeMetadata setRequiresExtent(boolean extent);
69  
70      /**
71       * Accessor for whether the component requires an extent.
72       * 
73       * @return Requires extent?
74       */
75      boolean getRequiresExtent();
76  
77      /**
78       * Method to set whether this is detachable
79       * 
80       * @param detachable Detachable?
81       */
82      TypeMetadata setDetachable(boolean detachable);
83  
84      /**
85       * Accessor for whether this is detachable.
86       * 
87       * @return Detachable?
88       */
89      boolean getDetachable();
90  
91      /**
92       * Method to set whether this is cacheable
93       * 
94       * @param cacheable Cacheable?
95       */
96      TypeMetadata setCacheable(boolean cacheable);
97  
98      /**
99       * Accessor for whether this is cacheable.
100      * 
101      * @return Detachable?
102      */
103     boolean getCacheable();
104 
105     /**
106      * Method to set the default value of serializeRead for objects of this type.
107      * 
108      * @param flag serializeRead
109      */
110     TypeMetadata setSerializeRead(boolean flag);
111 
112     /**
113      * Accessor for the value of serializeRead for objects of this type.
114      * 
115      * @return SerializeRead?
116      */
117     boolean getSerializeRead();
118 
119     /**
120      * Method to set whether it is stored only as embedded in other objects.
121      * 
122      * @param embedded Whether it is only stored embedded
123      */
124     TypeMetadata setEmbeddedOnly(boolean embedded);
125 
126     /**
127      * Accessor for whether this is embedded only.
128      * 
129      * @return Only stored as embedded
130      */
131     Boolean getEmbeddedOnly();
132 
133     /**
134      * Method to set the catalog (ORM) for this component
135      * 
136      * @param catalog Catalog name
137      */
138     TypeMetadata setCatalog(String catalog);
139 
140     /**
141      * Accessor for the catalog (ORM) for this component
142      * 
143      * @return The catalog
144      */
145     String getCatalog();
146 
147     /**
148      * Method to set the schema (ORM) for this component
149      * 
150      * @param schema Schema name
151      */
152     TypeMetadata setSchema(String schema);
153 
154     /**
155      * Accessor for the schema (ORM) for this component
156      * 
157      * @return The schema
158      */
159     String getSchema();
160 
161     /**
162      * Method to set the table name.
163      * 
164      * @param table Table name
165      */
166     TypeMetadata setTable(String table);
167 
168     /**
169      * Accessor for the name of the table.
170      * 
171      * @return The name
172      */
173     String getTable();
174 
175     /**
176      * Method to define the inheritance metadata.
177      * 
178      * @return The InheritanceMetadata
179      */
180     InheritanceMetadata newInheritanceMetadata();
181 
182     /**
183      * Accessor for the inheritance (if any).
184      * 
185      * @return inheritance
186      */
187     InheritanceMetadata getInheritanceMetadata();
188 
189     /**
190      * Method to define the version metadata.
191      * 
192      * @return The VersionMetadata
193      */
194     VersionMetadata newVersionMetadata();
195 
196     /**
197      * Accessor for the version (if any).
198      * 
199      * @return version
200      */
201     VersionMetadata getVersionMetadata();
202 
203     /**
204      * Method to define the datastore identity metadata details.
205      * 
206      * @return The DatastoreIdentityMetadata
207      */
208     DatastoreIdentityMetadata newDatastoreIdentityMetadata();
209 
210     /**
211      * Accessor for the datastore identity details.
212      * 
213      * @return datastore identity details
214      */
215     DatastoreIdentityMetadata getDatastoreIdentityMetadata();
216 
217     /**
218      * Method to define the primary key details.
219      * 
220      * @return The PrimaryKeyMetadata
221      */
222     PrimaryKeyMetadata newPrimaryKeyMetadata();
223 
224     /**
225      * Accessor for the primary key (if any).
226      * 
227      * @return primary key details
228      */
229     PrimaryKeyMetadata getPrimaryKeyMetadata();
230 
231     /**
232      * Accessor for all joins(s) defined on the component.
233      * 
234      * @return The join(s)
235      */
236     JoinMetadata[] getJoins();
237 
238     /**
239      * Add a join for this component.
240      * 
241      * @return The JoinMetadata
242      */
243     JoinMetadata newJoinMetadata();
244 
245     /**
246      * Accessor for the number of join(s) defined for this component.
247      * 
248      * @return The number of join(s)
249      */
250     int getNumberOfJoins();
251 
252     /**
253      * Accessor for all fk(s) defined on the component.
254      * 
255      * @return The fk(s)
256      */
257     ForeignKeyMetadata[] getForeignKeys();
258 
259     /**
260      * Add a new FK for this component.
261      * 
262      * @return The ForeignKeyMetadata
263      */
264     ForeignKeyMetadata newForeignKeyMetadata();
265 
266     /**
267      * Accessor for the number of FKs defined for this component.
268      * 
269      * @return The number of FKs
270      */
271     int getNumberOfForeignKeys();
272 
273     /**
274      * Accessor for all index(s) defined on the component.
275      * 
276      * @return The index(s)
277      */
278     IndexMetadata[] getIndices();
279 
280     /**
281      * Add a new index for this component.
282      * 
283      * @return The IndexMetadata
284      */
285     IndexMetadata newIndexMetadata();
286 
287     /**
288      * Accessor for the number of indices defined for this component.
289      * 
290      * @return The number of indices
291      */
292     int getNumberOfIndices();
293 
294     /**
295      * Accessor for all unique constraints defined on the component.
296      * 
297      * @return The unique constraints
298      */
299     UniqueMetadata[] getUniques();
300 
301     /**
302      * Add a new unique constraint for this component.
303      * 
304      * @return The UniqueMetadata
305      */
306     UniqueMetadata newUniqueMetadata();
307 
308     /**
309      * Accessor for the number of unique constraints defined for this component.
310      * 
311      * @return The number of unique constraints
312      */
313     int getNumberOfUniques();
314 
315     /**
316      * Accessor for all fields/properties defined on the component.
317      * 
318      * @return The members
319      */
320     MemberMetadata[] getMembers();
321 
322     /**
323      * Accessor for the number of fields/properties defined for this component.
324      * 
325      * @return The number of members
326      */
327     int getNumberOfMembers();
328 
329     /**
330      * Add a new property for this component.
331      * 
332      * @param name Name of the property
333      * @return The PropertyMetadata
334      */
335     PropertyMetadata newPropertyMetadata(String name);
336 
337     /**
338      * Add a new property for this component.
339      * 
340      * @param method Java bean getter/setter method
341      * @return The PropertyMetadata
342      */
343     PropertyMetadata newPropertyMetadata(Method method);
344 
345     /**
346      * Accessor for all named queries defined on the component.
347      * 
348      * @return The queries
349      */
350     QueryMetadata[] getQueries();
351 
352     /**
353      * Add a new query for this component.
354      * 
355      * @param name
356      *            Name of the query to add
357      * @return The QueryMetadata
358      */
359     QueryMetadata newQueryMetadata(String name);
360 
361     /**
362      * Accessor for the number of named queries defined for this component.
363      * 
364      * @return The number of named queries
365      */
366     int getNumberOfQueries();
367 
368     /**
369      * Accessor for all FetchGroup defined on the component.
370      * 
371      * @return The FetchGroups
372      */
373     FetchGroupMetadata[] getFetchGroups();
374 
375     /**
376      * Add a new FetchGroup for this component.
377      * 
378      * @param name Name of the FetchGroup
379      * @return The FetchGroupMetadata
380      */
381     FetchGroupMetadata newFetchGroupMetadata(String name);
382 
383     /**
384      * Accessor for the number of fetchGroups defined for this component.
385      * 
386      * @return The number of fetch groups
387      */
388     int getNumberOfFetchGroups();
389 
390     /**
391      * Accessor for all column(s) defined on the join.
392      * 
393      * @return The column(s)
394      */
395     ColumnMetadata[] getColumns();
396 
397     /**
398      * Add a new column for this join.
399      * 
400      * @return The ColumnMetadata
401      */
402     ColumnMetadata newColumnMetadata();
403 
404     /**
405      * Accessor for the number of columns defined for this join.
406      * 
407      * @return The number of columns
408      */
409     int getNumberOfColumns();
410 }