View Javadoc
1   /*
2    * reserved comment block
3    * DO NOT REMOVE OR ALTER!
4    */
5   /*
6    * Copyright 2001, 2002,2004 The Apache Software Foundation.
7    *
8    * Licensed under the Apache License, Version 2.0 (the "License");
9    * you may not use this file except in compliance with the License.
10   * You may obtain a copy of the License at
11   *
12   *      http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  
21  package com.sun.org.apache.xerces.internal.impl.xs.identity;
22  
23  import com.sun.org.apache.xerces.internal.xs.XSIDCDefinition;
24  
25  /**
26   * Schema key reference identity constraint.
27   *
28   * @xerces.internal
29   *
30   * @author Andy Clark, IBM
31   */
32  public class KeyRef
33      extends IdentityConstraint {
34  
35      //
36      // Data
37      //
38  
39      /** The key (or unique) being referred to. */
40      protected UniqueOrKey fKey;
41  
42      //
43      // Constructors
44      //
45  
46      /** Constructs a keyref with the specified name. */
47      public KeyRef(String namespace, String identityConstraintName,
48                    String elemName, UniqueOrKey key) {
49          super(namespace, identityConstraintName, elemName);
50          fKey = key;
51          type = IC_KEYREF;
52      } // <init>(String,String,String)
53  
54      //
55      // Public methods
56      //
57  
58      /** Returns the key being referred to.  */
59      public UniqueOrKey getKey() {
60          return fKey;
61      } // getKey(): int
62  
63      /**
64       * {referenced key} Required if {identity-constraint category} is keyref,
65       * forbidden otherwise. An identity-constraint definition with
66       * {identity-constraint category} equal to key or unique.
67       */
68      public XSIDCDefinition getRefKey() {
69          return fKey;
70      }
71  
72  } // class KeyRef