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 javax.jdo.annotations.ForeignKeyAction;
20  import javax.jdo.annotations.IdGeneratorStrategy;
21  import javax.jdo.annotations.NullValue;
22  import javax.jdo.annotations.PersistenceModifier;
23  
24  /**
25   * Represents a field/property in a class/persistent-interface.
26   * @since 3.0
27   */
28  public interface MemberMetadata extends Metadata {
29      /**
30       * Method to set the name.
31       * 
32       * @param name name
33       */
34      MemberMetadata setName(String name);
35  
36      /**
37       * Accessor for the name of the field/property.
38       * 
39       * @return The name
40       */
41      String getName();
42  
43      /**
44       * Method to set the table name.
45       * 
46       * @param table Table name
47       */
48      MemberMetadata setTable(String table);
49  
50      /**
51       * Accessor for the name of the table.
52       * 
53       * @return The name
54       */
55      String getTable();
56  
57      /**
58       * Method to set the column name.
59       * 
60       * @param col Column name
61       */
62      MemberMetadata setColumn(String col);
63  
64      /**
65       * Accessor for the name of the column.
66       * 
67       * @return The column name
68       */
69      String getColumn();
70  
71      /**
72       * Method to set the field type(s). For defining where we want to restrict
73       * what type is stored in a field
74       * 
75       * @param type Type of field
76       */
77      MemberMetadata setFieldType(String type);
78  
79      /**
80       * Accessor for the type storable in the field
81       * 
82       * @return The field type
83       */
84      String getFieldType();
85  
86      /**
87       * Method to set the delete action of the FK
88       * 
89       * @param action Delete action of the FK
90       */
91      MemberMetadata setDeleteAction(ForeignKeyAction action);
92  
93      /**
94       * Accessor for the delete action of the FK
95       * 
96       * @return The FK delete-action
97       */
98      ForeignKeyAction getDeleteAction();
99  
100     /**
101      * Method to set the persistence-modifier of the field/property.
102      * 
103      * @param mod persistence modifier
104      */
105     MemberMetadata setPersistenceModifier(PersistenceModifier mod);
106 
107     /**
108      * Accessor for the persistence modifier of the field/property.
109      * 
110      * @return The persistence modifier
111      */
112     PersistenceModifier getPersistenceModifier();
113 
114     /**
115      * Method to set the behaviour of a null value
116      * 
117      * @param val Null value behaviour
118      */
119     MemberMetadata setNullValue(NullValue val);
120 
121     /**
122      * Accessor for the behaviour of a null value
123      * 
124      * @return The null value behaviour
125      */
126     NullValue getNullValue();
127 
128     /**
129      * Method to set whether it is in the DFG.
130      * 
131      * @param dfg DFG?
132      */
133     MemberMetadata setDefaultFetchGroup(boolean dfg);
134 
135     /**
136      * Accessor for whether part of the DFG.
137      * 
138      * @return dfg?
139      */
140     Boolean getDefaultFetchGroup();
141 
142     /**
143      * Method to set whether it is unique.
144      * 
145      * @param unique Unique?
146      */
147     MemberMetadata setDependent(boolean unique);
148 
149     /**
150      * Accessor for whether unique.
151      * 
152      * @return Unique?
153      */
154     Boolean getDependent();
155 
156     /**
157      * Method to set whether it is embedded.
158      * 
159      * @param emb Embedded?
160      */
161     MemberMetadata setEmbedded(boolean emb);
162 
163     /**
164      * Accessor for whether it is embedded.
165      * 
166      * @return embedded?
167      */
168     Boolean getEmbedded();
169 
170     /**
171      * Method to set whether it is serialized.
172      * 
173      * @param ser serialized?
174      */
175     MemberMetadata setSerialized(boolean ser);
176 
177     /**
178      * Accessor for whether it is serialized.
179      * 
180      * @return serialized?
181      */
182     Boolean getSerialized();
183 
184     /**
185      * Method to set whether it is part of the pk
186      * 
187      * @param pk PK?
188      */
189     MemberMetadata setPrimaryKey(boolean pk);
190 
191     /**
192      * Accessor for whether it is part of the pk.
193      * 
194      * @return pk?
195      */
196     boolean getPrimaryKey();
197 
198     /**
199      * Method to set whether it is indexed.
200      * 
201      * @param index Indexed?
202      */
203     MemberMetadata setIndexed(boolean index);
204 
205     /**
206      * Accessor for whether it is indexed.
207      * 
208      * @return Indexed?
209      */
210     Boolean getIndexed();
211 
212     /**
213      * Method to set whether it is unique.
214      * 
215      * @param unique Unique?
216      */
217     MemberMetadata setUnique(boolean unique);
218 
219     /**
220      * Accessor for whether unique.
221      * 
222      * @return Unique?
223      */
224     Boolean getUnique();
225 
226     /**
227      * Method to set whether this is cacheable
228      * 
229      * @param cacheable Cacheable?
230      */
231     MemberMetadata setCacheable(boolean cacheable);
232 
233     /**
234      * Accessor for whether this is cacheable.
235      * 
236      * @return Detachable?
237      */
238     boolean getCacheable();
239 
240     /**
241      * Method to set the recursion depth (when used in a fetch group).
242      * 
243      * @param depth Recursion depth
244      */
245     MemberMetadata setRecursionDepth(int depth);
246 
247     /**
248      * Accessor for the recursion depth (when part of a fetch group).
249      * 
250      * @return Recursion depth?
251      */
252     int getRecursionDepth();
253 
254     /**
255      * Method to set the load fetch group.
256      * 
257      * @param grp Load fetch group
258      */
259     MemberMetadata setLoadFetchGroup(String grp);
260 
261     /**
262      * Accessor for the name of the load fetch group
263      * 
264      * @return The load fetch group
265      */
266     String getLoadFetchGroup();
267 
268     /**
269      * Method to set the value strategy
270      * 
271      * @param str Value strategy
272      */
273     MemberMetadata setValueStrategy(IdGeneratorStrategy str);
274 
275     /**
276      * Accessor for the value strategy
277      * 
278      * @return Value strategy
279      */
280     IdGeneratorStrategy getValueStrategy();
281 
282     /**
283      * Method to set the custom identity generation strategy.
284      * 
285      * @param strategy The strategy
286      */
287     MemberMetadata setCustomStrategy(String strategy);
288 
289     /**
290      * Accessor for the custom strategy (overriding "strategy").
291      * 
292      * @return The strategy
293      */
294     String getCustomStrategy();
295 
296     /**
297      * Method to set the sequence (when using value-strategy of "sequence")
298      * 
299      * @param seq Sequence key
300      */
301     MemberMetadata setSequence(String seq);
302 
303     /**
304      * Accessor for the sequence (when using value-strategy of "sequence")
305      * 
306      * @return Sequence key
307      */
308     String getSequence();
309 
310     /**
311      * Method to set the field on the other side of a bidirectional relation
312      * (this side is owner)
313      * 
314      * @param map  mapped-by field/property
315      */
316     MemberMetadata setMappedBy(String map);
317 
318     /**
319      * Accessor for the mapped-by field/property
320      * 
321      * @return mapped-by field/property
322      */
323     String getMappedBy();
324 
325     /**
326      * Method to define the array details (if the field/property is an array)
327      * 
328      * @return The ArrayMetadata
329      */
330     ArrayMetadata newArrayMetadata();
331 
332     /**
333      * Accessor for the array details.
334      * 
335      * @return array details
336      */
337     ArrayMetadata getArrayMetadata();
338 
339     /**
340      * Method to define the array details (if the field/property is an array)
341      * 
342      * @return The ArrayMetadata
343      */
344     CollectionMetadata newCollectionMetadata();
345 
346     /**
347      * Accessor for the array details.
348      * 
349      * @return array details
350      */
351     CollectionMetadata getCollectionMetadata();
352 
353     /**
354      * Method to define the map details (if the field/property is an map)
355      * 
356      * @return The MapMetadata
357      */
358     MapMetadata newMapMetadata();
359 
360     /**
361      * Accessor for the map details.
362      * 
363      * @return map details
364      */
365     MapMetadata getMapMetadata();
366 
367     /**
368      * Method to define the join details
369      * 
370      * @return The JoinMetadata
371      */
372     JoinMetadata newJoinMetadata();
373 
374     /**
375      * Accessor for the join details.
376      * 
377      * @return join details
378      */
379     JoinMetadata getJoinMetadata();
380 
381     /**
382      * Method to define the embedded details
383      * 
384      * @return The EmbeddedMetadata
385      */
386     EmbeddedMetadata newEmbeddedMetadata();
387 
388     /**
389      * Accessor for the embedded metadata.
390      * 
391      * @return embedded metadata
392      */
393     EmbeddedMetadata getEmbeddedMetadata();
394 
395     /**
396      * Method to define the new element details
397      * 
398      * @return The ElementMetadata
399      */
400     ElementMetadata newElementMetadata();
401 
402     /**
403      * Accessor for the element details
404      * 
405      * @return element details
406      */
407     ElementMetadata getElementMetadata();
408 
409     /**
410      * Method to define the key details
411      * 
412      * @return The KeyMetadata
413      */
414     KeyMetadata newKeyMetadata();
415 
416     /**
417      * Accessor for the key details
418      * 
419      * @return key details
420      */
421     KeyMetadata getKeyMetadata();
422 
423     /**
424      * Method to define the value details
425      * 
426      * @return The ValueMetadata
427      */
428     ValueMetadata newValueMetadata();
429 
430     /**
431      * Accessor for the value details
432      * 
433      * @return value details
434      */
435     ValueMetadata getValueMetadata();
436 
437     /**
438      * Method to set index metadata for the field/property
439      * 
440      * @return The metadata for any index
441      */
442     IndexMetadata newIndexMetadata();
443 
444     /**
445      * Accessor for any index metadata for the field/property
446      * 
447      * @return Index metadata
448      */
449     IndexMetadata getIndexMetadata();
450 
451     /**
452      * Method to set new unique constraint metadata for the field/property
453      * 
454      * @return The UniqueMetadata
455      */
456     UniqueMetadata newUniqueMetadata();
457 
458     /**
459      * Accessor for any unique constraint metadata on this field/property.
460      * 
461      * @return The UniqueMetadata
462      */
463     UniqueMetadata getUniqueMetadata();
464 
465     /**
466      * Method to set new foreign key metadata for the field/property
467      * 
468      * @return The ForeignKeyMetadata
469      */
470     ForeignKeyMetadata newForeignKeyMetadata();
471 
472     /**
473      * Accessor for any foreign key metadata on this field/property.
474      * 
475      * @return The ForeignKeyMetadata
476      */
477     ForeignKeyMetadata getForeignKeyMetadata();
478 
479     /**
480      * Method to define the order details.
481      * 
482      * @return The OrdeMetadata
483      */
484     OrderMetadata newOrderMetadata();
485 
486     /**
487      * Accessor for the order metadata.
488      * 
489      * @return order metadata
490      */
491     OrderMetadata getOrderMetadata();
492 
493     /**
494      * Accessor for all column(s) defined on the join.
495      * 
496      * @return The column(s)
497      */
498     ColumnMetadata[] getColumns();
499 
500     /**
501      * Add a new column for this join.
502      * 
503      * @return The ColumnMetadata
504      */
505     ColumnMetadata newColumnMetadata();
506 
507     /**
508      * Accessor for the number of columns defined for this join.
509      * 
510      * @return The number of columns
511      */
512     int getNumberOfColumns();
513 }