Fri, 14 Feb 2014 11:13:45 +0100
8026188: Enhance envelope factory
Summary: Avoiding caching data initialized via TCCL in static context; fix also reviewed by Alexander Fomin
Reviewed-by: ahgross, mgrebac, skoivu
1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 package com.sun.xml.internal.xsom;
28 import java.util.List;
29 import java.util.Set;
31 /**
32 * Element declaration.
33 *
34 * @author
35 * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
36 */
37 public interface XSElementDecl extends XSDeclaration, XSTerm
38 {
39 /**
40 * Gets the type of this element declaration.
41 * @return
42 * always non-null.
43 */
44 XSType getType();
46 boolean isNillable();
48 /**
49 * Gets the substitution head of this element, if any.
50 * Otherwise null.
51 */
52 XSElementDecl getSubstAffiliation();
54 /**
55 * Returns all the {@link XSIdentityConstraint}s in this element decl.
56 *
57 * @return
58 * never null, but can be empty.
59 */
60 List<XSIdentityConstraint> getIdentityConstraints();
62 /**
63 * Checks the substitution excluded property of the schema component.
64 *
65 * IOW, this checks the value of the <code>final</code> attribute
66 * (plus <code>finalDefault</code>).
67 *
68 * @param method
69 * Possible values are {@link XSType#EXTENSION} or
70 * <code>XSType.RESTRICTION</code>.
71 */
72 boolean isSubstitutionExcluded(int method);
74 /**
75 * Checks the diallowed substitution property of the schema component.
76 *
77 * IOW, this checks the value of the <code>block</code> attribute
78 * (plus <code>blockDefault</code>).
79 *
80 * @param method
81 * Possible values are {@link XSType#EXTENSION},
82 * <code>XSType.RESTRICTION</code>, or <code>XSType.SUBSTITUTION</code>
83 */
84 boolean isSubstitutionDisallowed(int method);
86 boolean isAbstract();
88 /**
89 * Returns the element declarations that can substitute
90 * this element.
91 *
92 * <p>
93 * IOW, this set returns all the element decls that satisfies
94 * <a href="http://www.w3.org/TR/xmlschema-1/#cos-equiv-derived-ok-rec">
95 * the "Substitution Group OK" constraint.
96 * </a>
97 *
98 * @return
99 * nun-null valid array. The return value always contains this element
100 * decl itself.
101 *
102 * @deprecated
103 * this method allocates a new array every time, so it could be
104 * inefficient when working with a large schema. Use
105 * {@link #getSubstitutables()} instead.
106 */
107 XSElementDecl[] listSubstitutables();
109 /**
110 * Returns the element declarations that can substitute
111 * this element.
112 *
113 * <p>
114 * IOW, this set returns all the element decls that satisfies
115 * <a href="http://www.w3.org/TR/xmlschema-1/#cos-equiv-derived-ok-rec">
116 * the "Substitution Group OK" constraint.
117 * </a>
118 *
119 * <p>
120 * Note that the above clause does <em>NOT</em> check for
121 * abstract elements. So abstract elements may still show up
122 * in the returned set.
123 *
124 * @return
125 * nun-null unmodifiable list.
126 * The returned list always contains this element decl itself.
127 */
128 Set<? extends XSElementDecl> getSubstitutables();
130 /**
131 * Returns true if this element declaration can be validly substituted
132 * by the given declaration.
133 *
134 * <p>
135 * Just a short cut of <tt>getSubstitutables().contain(e);</tt>
136 */
137 boolean canBeSubstitutedBy(XSElementDecl e);
139 // TODO: identitiy constraints
140 // TODO: scope
142 XmlString getDefaultValue();
143 XmlString getFixedValue();
145 /**
146 * Used for javadoc schema generation
147 *
148 * @return
149 * null if form attribute not present,
150 * true if form attribute present and set to qualified,
151 * false if form attribute present and set to unqualified.
152 */
154 Boolean getForm();
155 }