jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XSAttributeUseImpl.java
author joehw
Mon, 13 Oct 2014 14:09:03 -0700
changeset 27111 7a491d709b83
parent 25868 686eef1e7a79
child 45853 bfa06be36a17
permissions -rw-r--r--
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java Reviewed-by: lancea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     1
/*
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     2
 * reserved comment block
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     4
 */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     5
/*
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
     6
 * Licensed to the Apache Software Foundation (ASF) under one or more
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
     7
 * contributor license agreements.  See the NOTICE file distributed with
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
     8
 * this work for additional information regarding copyright ownership.
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
     9
 * The ASF licenses this file to You under the Apache License, Version 2.0
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    10
 * (the "License"); you may not use this file except in compliance with
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    11
 * the License.  You may obtain a copy of the License at
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    12
 *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    13
 *      http://www.apache.org/licenses/LICENSE-2.0
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    14
 *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    15
 * Unless required by applicable law or agreed to in writing, software
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    16
 * distributed under the License is distributed on an "AS IS" BASIS,
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    18
 * See the License for the specific language governing permissions and
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    19
 * limitations under the License.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    20
 */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    21
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    22
package com.sun.org.apache.xerces.internal.impl.xs;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    23
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    24
import com.sun.org.apache.xerces.internal.impl.dv.ValidatedInfo;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    25
import com.sun.org.apache.xerces.internal.impl.xs.util.XSObjectListImpl;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    26
import com.sun.org.apache.xerces.internal.xs.ShortList;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    27
import com.sun.org.apache.xerces.internal.xs.XSAttributeDeclaration;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    28
import com.sun.org.apache.xerces.internal.xs.XSAttributeUse;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    29
import com.sun.org.apache.xerces.internal.xs.XSConstants;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    30
import com.sun.org.apache.xerces.internal.xs.XSNamespaceItem;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    31
import com.sun.org.apache.xerces.internal.xs.XSObjectList;
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    32
import com.sun.org.apache.xerces.internal.xs.XSValue;
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    33
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    34
/**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    35
 * The XML representation for an attribute use
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    36
 * schema component is a local <attribute> element information item
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    37
 *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    38
 * @xerces.internal
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    39
 *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    40
 * @author Sandy Gao, IBM
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    41
 */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    42
public class XSAttributeUseImpl implements XSAttributeUse {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    43
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    44
    // the referred attribute decl
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    45
    public XSAttributeDecl fAttrDecl = null;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    46
    // use information: SchemaSymbols.USE_OPTIONAL, REQUIRED, PROHIBITED
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    47
    public short fUse = SchemaSymbols.USE_OPTIONAL;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    48
    // value constraint type: default, fixed or !specified
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    49
    public short fConstraintType = XSConstants.VC_NONE;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    50
    // value constraint value
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    51
    public ValidatedInfo fDefault = null;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    52
    // optional annotation
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    53
    public XSObjectList fAnnotations = null;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    54
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    55
    public void reset(){
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    56
        fDefault = null;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    57
        fAttrDecl = null;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    58
        fUse = SchemaSymbols.USE_OPTIONAL;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    59
        fConstraintType = XSConstants.VC_NONE;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    60
        fAnnotations = null;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    61
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    62
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    63
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    64
     * Get the type of the object, i.e ELEMENT_DECLARATION.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    65
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    66
    public short getType() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    67
        return XSConstants.ATTRIBUTE_USE;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    68
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    69
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    70
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    71
     * The <code>name</code> of this <code>XSObject</code> depending on the
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    72
     * <code>XSObject</code> type.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    73
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    74
    public String getName() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    75
        return null;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    76
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    77
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    78
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    79
     * The namespace URI of this node, or <code>null</code> if it is
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    80
     * unspecified.  defines how a namespace URI is attached to schema
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    81
     * components.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    82
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    83
    public String getNamespace() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    84
        return null;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    85
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    86
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    87
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    88
     * {required} determines whether this use of an attribute declaration
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    89
     * requires an appropriate attribute information item to be present, or
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    90
     * merely allows it.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    91
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    92
    public boolean getRequired() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    93
        return fUse == SchemaSymbols.USE_REQUIRED;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    94
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    95
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    96
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    97
     * {attribute declaration} provides the attribute declaration itself,
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    98
     * which will in turn determine the simple type definition used.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    99
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   100
    public XSAttributeDeclaration getAttrDeclaration() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   101
        return fAttrDecl;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   102
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   103
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   104
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   105
     * Value Constraint: one of default, fixed.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   106
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   107
    public short getConstraintType() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   108
        return fConstraintType;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   109
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   110
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   111
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   112
     * Value Constraint: The actual value (with respect to the {type
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   113
     * definition}).
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   114
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   115
    public String getConstraintValue() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   116
        // REVISIT: SCAPI: what's the proper representation
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   117
        return getConstraintType() == XSConstants.VC_NONE ?
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   118
               null :
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   119
               fDefault.stringValue();
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   120
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   121
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   122
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   123
     * @see org.apache.xerces.xs.XSObject#getNamespaceItem()
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   124
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   125
    public XSNamespaceItem getNamespaceItem() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   126
        return null;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   127
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   128
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   129
    public Object getActualVC() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   130
        return getConstraintType() == XSConstants.VC_NONE ?
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   131
               null :
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   132
               fDefault.actualValue;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   133
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   134
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   135
    public short getActualVCType() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   136
        return getConstraintType() == XSConstants.VC_NONE ?
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   137
               XSConstants.UNAVAILABLE_DT :
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   138
               fDefault.actualValueType;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   139
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   140
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   141
    public ShortList getItemValueTypes() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   142
        return getConstraintType() == XSConstants.VC_NONE ?
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   143
               null :
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   144
               fDefault.itemValueTypes;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   145
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   146
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   147
    public XSValue getValueConstraintValue() {
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   148
        return fDefault;
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   149
    }
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   150
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   151
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   152
     * Optional. Annotations.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   153
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   154
    public XSObjectList getAnnotations() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   155
        return (fAnnotations != null) ? fAnnotations : XSObjectListImpl.EMPTY_LIST;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   156
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   157
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   158
} // class XSAttributeUseImpl