001: /*
002: * The contents of this file are subject to the terms
003: * of the Common Development and Distribution License
004: * (the "License"). You may not use this file except
005: * in compliance with the License.
006: *
007: * You can obtain a copy of the license at
008: * https://jwsdp.dev.java.net/CDDLv1.0.html
009: * See the License for the specific language governing
010: * permissions and limitations under the License.
011: *
012: * When distributing Covered Code, include this CDDL
013: * HEADER in each file and include the License file at
014: * https://jwsdp.dev.java.net/CDDLv1.0.html If applicable,
015: * add the following below this CDDL HEADER, with the
016: * fields enclosed by brackets "[]" replaced with your
017: * own identifying information: Portions Copyright [yyyy]
018: * [name of copyright owner]
019: */
020: package com.sun.xml.xsom;
021:
022: import java.util.List;
023: import java.util.Set;
024:
025: /**
026: * Element declaration.
027: *
028: * @author
029: * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
030: */
031: public interface XSElementDecl extends XSDeclaration, XSTerm {
032: /**
033: * Gets the type of this element declaration.
034: * @return
035: * always non-null.
036: */
037: XSType getType();
038:
039: boolean isNillable();
040:
041: /**
042: * Gets the substitution head of this element, if any.
043: * Otherwise null.
044: */
045: XSElementDecl getSubstAffiliation();
046:
047: /**
048: * Returns all the {@link XSIdentityConstraint}s in this element decl.
049: *
050: * @return
051: * never null, but can be empty.
052: */
053: List<XSIdentityConstraint> getIdentityConstraints();
054:
055: /**
056: * Checks the substitution excluded property of the schema component.
057: *
058: * IOW, this checks the value of the <code>final</code> attribute
059: * (plus <code>finalDefault</code>).
060: *
061: * @param method
062: * Possible values are {@link XSType#EXTENSION} or
063: * <code>XSType.RESTRICTION</code>.
064: */
065: boolean isSubstitutionExcluded(int method);
066:
067: /**
068: * Checks the diallowed substitution property of the schema component.
069: *
070: * IOW, this checks the value of the <code>block</code> attribute
071: * (plus <code>blockDefault</code>).
072: *
073: * @param method
074: * Possible values are {@link XSType#EXTENSION},
075: * <code>XSType.RESTRICTION</code>, or <code>XSType.SUBSTITUTION</code>
076: */
077: boolean isSubstitutionDisallowed(int method);
078:
079: boolean isAbstract();
080:
081: /**
082: * Returns the element declarations that can substitute
083: * this element.
084: *
085: * <p>
086: * IOW, this set returns all the element decls that satisfies
087: * <a href="http://www.w3.org/TR/xmlschema-1/#cos-equiv-derived-ok-rec">
088: * the "Substitution Group OK" constraint.
089: * </a>
090: *
091: * @return
092: * nun-null valid array. The return value always contains this element
093: * decl itself.
094: *
095: * @deprecated
096: * this method allocates a new array every time, so it could be
097: * inefficient when working with a large schema. Use
098: * {@link #getSubstitutables()} instead.
099: */
100: XSElementDecl[] listSubstitutables();
101:
102: /**
103: * Returns the element declarations that can substitute
104: * this element.
105: *
106: * <p>
107: * IOW, this set returns all the element decls that satisfies
108: * <a href="http://www.w3.org/TR/xmlschema-1/#cos-equiv-derived-ok-rec">
109: * the "Substitution Group OK" constraint.
110: * </a>
111: *
112: * <p>
113: * Note that the above clause does <em>NOT</em> check for
114: * abstract elements. So abstract elements may still show up
115: * in the returned set.
116: *
117: * @return
118: * nun-null unmodifiable list.
119: * The returned list always contains this element decl itself.
120: */
121: Set<? extends XSElementDecl> getSubstitutables();
122:
123: /**
124: * Returns true if this element declaration can be validly substituted
125: * by the given declaration.
126: *
127: * <p>
128: * Just a short cut of <tt>getSubstitutables().contain(e);</tt>
129: */
130: boolean canBeSubstitutedBy(XSElementDecl e);
131:
132: // TODO: identitiy constraints
133: // TODO: scope
134:
135: XmlString getDefaultValue();
136:
137: XmlString getFixedValue();
138: }
|