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  
21  /**
22   * Represents a FK constraint in an ORM context.
23   * @since 3.0
24   */
25  public interface ForeignKeyMetadata extends Metadata {
26      /**
27       * Method to set the name of the constraint
28       * 
29       * @param name Name of the constraint
30       */
31      ForeignKeyMetadata setName(String name);
32  
33      /**
34       * Accessor for the constraint name.
35       * 
36       * @return The constraint name
37       */
38      String getName();
39  
40      /**
41       * Method to set the table name.
42       * 
43       * @param table Table name
44       */
45      ForeignKeyMetadata setTable(String table);
46  
47      /**
48       * Accessor for the name of the table.
49       * 
50       * @return The name
51       */
52      String getTable();
53  
54      /**
55       * Method to set whether it is unique.
56       * 
57       * @param unique Unique?
58       */
59      ForeignKeyMetadata setUnique(boolean unique);
60  
61      /**
62       * Accessor for whether unique.
63       * 
64       * @return Unique?
65       */
66      Boolean getUnique();
67  
68      /**
69       * Method to set whether it is deferred.
70       * 
71       * @param def Deferred?
72       */
73      ForeignKeyMetadata setDeferred(boolean def);
74  
75      /**
76       * Accessor for whether the constraint can be deferred.
77       * 
78       * @return Deferred?
79       */
80      Boolean getDeferred();
81  
82      /**
83       * Method to set the delete action of the FK
84       * 
85       * @param action Delete action of the FK
86       */
87      ForeignKeyMetadata setDeleteAction(ForeignKeyAction action);
88  
89      /**
90       * Accessor for the delete action of the FK
91       * 
92       * @return The FK delete-action
93       */
94      ForeignKeyAction getDeleteAction();
95  
96      /**
97       * Method to set the update action of the FK
98       * 
99       * @param action Update action of the FK
100      */
101     ForeignKeyMetadata setUpdateAction(ForeignKeyAction action);
102 
103     /**
104      * Accessor for the update action of the FK
105      * 
106      * @return The FK update-action
107      */
108     ForeignKeyAction getUpdateAction();
109 
110     /**
111      * Accessor for all column(s) defined on the FK.
112      * 
113      * @return The column(s)
114      */
115     ColumnMetadata[] getColumns();
116 
117     /**
118      * Add a new column for this FK.
119      * 
120      * @return The ColumnMetadata
121      */
122     ColumnMetadata newColumnMetadata();
123 
124     /**
125      * Accessor for the number of columns defined for this FK.
126      * 
127      * @return The number of columns
128      */
129     int getNumberOfColumns();
130 
131     /**
132      * Accessor for all fields/properties defined on the FK.
133      * @return The members
134      */
135     MemberMetadata[] getMembers();
136 
137     /**
138      * Accessor for the number of fields/properties defined for this FK.
139      * @return The number of members
140      */
141     int getNumberOfMembers();
142 
143     /**
144      * Add a new field for this FK.
145      * 
146      * @param name Name of the field
147      * @return The FieldMetadata
148      */
149     FieldMetadata newFieldMetadata(String name);
150 
151     /**
152      * Add a new property for this FK.
153      * 
154      * @param name Name of the property
155      * @return The PropertyMetadata
156      */
157     PropertyMetadata newPropertyMetadata(String name);
158 }