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 the primary key definition of a class.
21   * @since 3.0
22   */
23  public interface PrimaryKeyMetadata extends Metadata {
24      /**
25       * Method to set the name of the PK constraint.
26       * 
27       * @param name Name of the PK constraint
28       * @return The PK metadata
29       */
30      PrimaryKeyMetadata setName(String name);
31  
32      /**
33       * Accessor for the name of the PK constraint.
34       * 
35       * @return The PK constraint name
36       */
37      String getName();
38  
39      /**
40       * Method to set the PK column name.
41       * 
42       * @param column Name of the PK column
43       * @return The PK metadata
44       */
45      PrimaryKeyMetadata setColumn(String column);
46  
47      /**
48       * Accessor for the PK column name
49       * 
50       * @return The column name
51       */
52      String getColumn();
53  
54      /**
55       * Accessor for all column(s) defined on the PK.
56       * 
57       * @return The column(s)
58       */
59      ColumnMetadata[] getColumns();
60  
61      /**
62       * Add a new column for this PK
63       * 
64       * @return The ColumnMetadata
65       */
66      ColumnMetadata newColumnMetadata();
67  
68      /**
69       * Accessor for the number of columns defined for this PK
70       * 
71       * @return The number of columns
72       */
73      int getNumberOfColumns();
74  }