1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   4  */
   5 /*
   6  * Copyright 1999-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;
  22 
  23 
  24 import com.sun.org.apache.xerces.internal.impl.xs.util.XSObjectListImpl;
  25 import com.sun.org.apache.xerces.internal.xs.XSAnnotation;
  26 import com.sun.org.apache.xerces.internal.xs.XSConstants;
  27 import com.sun.org.apache.xerces.internal.xs.XSModelGroup;
  28 import com.sun.org.apache.xerces.internal.xs.XSModelGroupDefinition;
  29 import com.sun.org.apache.xerces.internal.xs.XSNamespaceItem;
  30 import com.sun.org.apache.xerces.internal.xs.XSObjectList;
  31 
  32 /**
  33  * The XML representation for a group declaration
  34  * schema component is a global <group> element information item
  35  *
  36  * @xerces.internal
  37  *
  38  * @author Sandy Gao, IBM
  39  */
  40 public class XSGroupDecl implements XSModelGroupDefinition {
  41 
  42     // name of the group
  43     public String fName = null;
  44     // target namespace of the group
  45     public String fTargetNamespace = null;
  46     // model group of the group
  47     public XSModelGroupImpl fModelGroup = null;
  48     // optional annotations
  49     public XSObjectList fAnnotations = null;
  50     // The namespace schema information item corresponding to the target namespace
  51     // of the model group definition, if it is globally declared; or null otherwise.
  52     private XSNamespaceItem fNamespaceItem = null;
  53 
  54     /**
  55      * Get the type of the object, i.e ELEMENT_DECLARATION.
  56      */
  57     public short getType() {
  58         return XSConstants.MODEL_GROUP_DEFINITION;
  59     }
  60 
  61     /**
  62      * The <code>name</code> of this <code>XSObject</code> depending on the
  63      * <code>XSObject</code> type.
  64      */
  65     public String getName() {
  66         return fName;
  67     }
  68 
  69     /**
  70      * The namespace URI of this node, or <code>null</code> if it is
  71      * unspecified.  defines how a namespace URI is attached to schema
  72      * components.
  73      */
  74     public String getNamespace() {
  75         return fTargetNamespace;
  76     }
  77 
  78     /**
  79      * {model group} A model group.
  80      */
  81     public XSModelGroup getModelGroup() {
  82         return fModelGroup;
  83     }
  84 
  85     /**
  86      * Optional. Annotation.
  87      */
  88     public XSAnnotation getAnnotation() {
  89         return (fAnnotations != null) ? (XSAnnotation) fAnnotations.item(0) : null;
  90     }
  91 
  92     /**
  93      * Optional. Annotations.
  94      */
  95     public XSObjectList getAnnotations() {
  96         return (fAnnotations != null) ? fAnnotations : XSObjectListImpl.EMPTY_LIST;
  97     }
  98 
  99     /**
 100      * @see org.apache.xerces.xs.XSObject#getNamespaceItem()
 101      */
 102     public XSNamespaceItem getNamespaceItem() {
 103         return fNamespaceItem;
 104     }
 105 
 106     void setNamespaceItem(XSNamespaceItem namespaceItem) {
 107         fNamespaceItem = namespaceItem;
 108     }
 109 
 110 } // class XSGroupDecl