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.SequenceStrategy;
20  
21  /**
22   * Represents a package within a JDOMetadata.
23   * @since 3.0
24   */
25  public interface PackageMetadata extends Metadata {
26      /**
27       * Accessor for the name of this package (set on construction).
28       * 
29       * @return The name
30       */
31      String getName();
32  
33      /**
34       * Method to set the catalog (ORM) to apply to all classes in this package.
35       * 
36       * @param catalog Catalog name
37       */
38      PackageMetadata setCatalog(String catalog);
39  
40      /**
41       * Accessor for the catalog (ORM) that all classes in this package default
42       * to.
43       * 
44       * @return The catalog
45       */
46      String getCatalog();
47  
48      /**
49       * Method to set the schema (ORM) to apply to all classes in this package.
50       * 
51       * @param schema Schema name
52       */
53      PackageMetadata setSchema(String schema);
54  
55      /**
56       * Accessor for the schema (ORM) that all classes in this package default to.
57       * 
58       * @return The schema
59       */
60      String getSchema();
61  
62      /**
63       * Accessor for all classes defined in this package.
64       * 
65       * @return The classes
66       */
67      ClassMetadata[] getClasses();
68  
69      /**
70       * Add a new class to this package.
71       * 
72       * @param name Name of the class
73       * @return The ClassMetadata
74       */
75      ClassMetadata newClassMetadata(String name);
76  
77      /**
78       * Add a new class to this package.
79       * 
80       * @param cls The class
81       * @return The ClassMetadata
82       */
83      ClassMetadata newClassMetadata(Class cls);
84  
85      /**
86       * Accessor for the number of classes defined in this package.
87       * 
88       * @return The number of classes.
89       */
90      int getNumberOfClasses();
91  
92      /**
93       * Accessor for all interfaces defined in this package.
94       * 
95       * @return The interfaces
96       */
97      InterfaceMetadata[] getInterfaces();
98  
99      /**
100      * Add a new interface to this package.
101      * 
102      * @param name The interface name
103      * @return The InterfaceMetadata
104      */
105     InterfaceMetadata newInterfaceMetadata(String name);
106 
107     /**
108      * Add a new interface to this package.
109      * 
110      * @param cls The class
111      * @return The ClassMetadata
112      */
113     InterfaceMetadata newInterfaceMetadata(Class cls);
114 
115     /**
116      * Accessor for the number of interfaces defined in this package.
117      * 
118      * @return The number of interfaces.
119      */
120     int getNumberOfInterfaces();
121 
122     /**
123      * Accessor for any sequences defined on the package.
124      * 
125      * @return The sequences
126      */
127     SequenceMetadata[] getSequences();
128 
129     /**
130      * Add a new sequence to this package.
131      * 
132      * @param name Name of the sequence
133      * @param strategy Strategy for the sequence
134      * @return The SequenceMetadata
135      */
136     SequenceMetadata newSequenceMetadata(String name, SequenceStrategy strategy);
137 
138     /**
139      * Accessor for the number of sequences defined for this package.
140      * 
141      * @return The number of sequences.
142      */
143     int getNumberOfSequences();
144 }