1/*
2 * reserved comment block
3 * DO NOT REMOVE OR ALTER!
4 */
5/*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements.  See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License.  You may obtain a copy of the License at
12 *
13 *      http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22package com.sun.org.apache.xerces.internal.impl.xs;
23
24
25import com.sun.org.apache.xerces.internal.impl.xs.util.XSObjectListImpl;
26import com.sun.org.apache.xerces.internal.xs.XSAnnotation;
27import com.sun.org.apache.xerces.internal.xs.XSConstants;
28import com.sun.org.apache.xerces.internal.xs.XSModelGroup;
29import com.sun.org.apache.xerces.internal.xs.XSModelGroupDefinition;
30import com.sun.org.apache.xerces.internal.xs.XSNamespaceItem;
31import com.sun.org.apache.xerces.internal.xs.XSObjectList;
32
33/**
34 * The XML representation for a group declaration
35 * schema component is a global <group> element information item
36 *
37 * @xerces.internal
38 *
39 * @author Sandy Gao, IBM
40 */
41public class XSGroupDecl implements XSModelGroupDefinition {
42
43    // name of the group
44    public String fName = null;
45    // target namespace of the group
46    public String fTargetNamespace = null;
47    // model group of the group
48    public XSModelGroupImpl fModelGroup = null;
49    // optional annotations
50    public XSObjectList fAnnotations = null;
51    // The namespace schema information item corresponding to the target namespace
52    // of the model group definition, if it is globally declared; or null otherwise.
53    private XSNamespaceItem fNamespaceItem = null;
54
55    /**
56     * Get the type of the object, i.e ELEMENT_DECLARATION.
57     */
58    public short getType() {
59        return XSConstants.MODEL_GROUP_DEFINITION;
60    }
61
62    /**
63     * The <code>name</code> of this <code>XSObject</code> depending on the
64     * <code>XSObject</code> type.
65     */
66    public String getName() {
67        return fName;
68    }
69
70    /**
71     * The namespace URI of this node, or <code>null</code> if it is
72     * unspecified.  defines how a namespace URI is attached to schema
73     * components.
74     */
75    public String getNamespace() {
76        return fTargetNamespace;
77    }
78
79    /**
80     * {model group} A model group.
81     */
82    public XSModelGroup getModelGroup() {
83        return fModelGroup;
84    }
85
86    /**
87     * Optional. Annotation.
88     */
89    public XSAnnotation getAnnotation() {
90        return (fAnnotations != null) ? (XSAnnotation) fAnnotations.item(0) : null;
91    }
92
93    /**
94     * Optional. Annotations.
95     */
96    public XSObjectList getAnnotations() {
97        return (fAnnotations != null) ? fAnnotations : XSObjectListImpl.EMPTY_LIST;
98    }
99
100    /**
101     * @see org.apache.xerces.xs.XSObject#getNamespaceItem()
102     */
103    public XSNamespaceItem getNamespaceItem() {
104        return fNamespaceItem;
105    }
106
107    void setNamespaceItem(XSNamespaceItem namespaceItem) {
108        fNamespaceItem = namespaceItem;
109    }
110
111} // class XSGroupDecl
112