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  /**
20   * Represents a unique constraint.
21   * @since 3.0
22   */
23  public interface UniqueMetadata extends Metadata {
24      /**
25       * Method to set the name of the constraint
26       * 
27       * @param name Name of the constraint
28       */
29      UniqueMetadata setName(String name);
30  
31      /**
32       * Accessor for the constraint name.
33       * 
34       * @return The constraint name
35       */
36      String getName();
37  
38      /**
39       * Method to set the table name.
40       * 
41       * @param table Table name
42       */
43      UniqueMetadata setTable(String table);
44  
45      /**
46       * Accessor for the name of the table.
47       * 
48       * @return The name
49       */
50      String getTable();
51  
52      /**
53       * Method to set whether the constraint is deferred.
54       * 
55       * @param def Deferred?
56       */
57      UniqueMetadata setDeferred(boolean def);
58  
59      /**
60       * Accessor for whether deferred.
61       * 
62       * @return Deferred?
63       */
64      Boolean getDeferred();
65  
66      /**
67       * Accessor for all column(s) defined on the unique constraint.
68       * 
69       * @return The column(s)
70       */
71      ColumnMetadata[] getColumns();
72  
73      /**
74       * Add a new column for this unique constraint.
75       * 
76       * @return The ColumnMetadata
77       */
78      ColumnMetadata newColumnMetadata();
79  
80      /**
81       * Accessor for the number of columns defined for this unique constraint.
82       * 
83       * @return The number of columns
84       */
85      int getNumberOfColumns();
86  
87      /**
88       * Accessor for all fields/properties defined on the unique constraint.
89       * @return The members
90       */
91      MemberMetadata[] getMembers();
92  
93      /**
94       * Accessor for the number of fields/properties defined for this unique constraint.
95       * @return The number of members
96       */
97      int getNumberOfMembers();
98  
99      /**
100      * Add a new field for this unique constraint.
101      * 
102      * @param name Name of the field
103      * @return The FieldMetadata
104      */
105     FieldMetadata newFieldMetadata(String name);
106 
107     /**
108      * Add a new property for this unique constraint.
109      * 
110      * @param name Name of the property
111      * @return The PropertyMetadata
112      */
113     PropertyMetadata newPropertyMetadata(String name);
114 }