KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > spi > persistence > support > sqlstore > model > KeyDesc


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * KeyDesc.java
26  *
27  * Created on March 3, 2000
28  *
29  */

30
31 package com.sun.jdo.spi.persistence.support.sqlstore.model;
32
33 import org.netbeans.modules.dbschema.ColumnElement;
34 import java.util.ArrayList JavaDoc;
35
36 /**
37  * This class is used to encapsulate an association between
38  * key fields and key columns.
39  */

40 public class KeyDesc {
41
42     /** Array of LocalFieldDesc */
43     private ArrayList JavaDoc fields;
44
45     /** Array of ColumnElements */
46     private ArrayList JavaDoc columns;
47
48     /** Initialize the columns ArrayList. */
49     void addColumns(ArrayList JavaDoc columns) {
50         this.columns = columns;
51     }
52
53     /** Add a field to the KeyDesc.
54      * @param f - FieldDesc to be added
55      */

56     void addField(FieldDesc f) {
57         if (fields == null)
58             fields = new ArrayList JavaDoc();
59
60         fields.add(f);
61     }
62
63     /** Add a column to this KeyDesc.
64      * @param c - ColumnElement to be added
65      */

66     void addColumn(ColumnElement c) {
67         if (columns == null)
68             columns = new ArrayList JavaDoc();
69
70         columns.add(c);
71     }
72
73     /** Return all key columns.
74      * @return an ArrayList of ColumnElements
75      */

76     public ArrayList JavaDoc getColumns() {
77         return columns;
78     }
79
80     /** Return all key fields.
81      * @return an ArrayList of FieldDescs
82      */

83     public ArrayList JavaDoc getFields() {
84         return fields;
85     }
86 }
87
88
89
90
91
Popular Tags