aoqi@0: /* aoqi@0: * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. Oracle designates this aoqi@0: * particular file as subject to the "Classpath" exception as provided aoqi@0: * by Oracle in the LICENSE file that accompanied this code. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: */ aoqi@0: aoqi@0: package com.sun.xml.internal.xsom; aoqi@0: aoqi@0: import java.util.List; aoqi@0: import java.util.Set; aoqi@0: aoqi@0: /** aoqi@0: * Element declaration. aoqi@0: * aoqi@0: * @author aoqi@0: * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) aoqi@0: */ aoqi@0: public interface XSElementDecl extends XSDeclaration, XSTerm aoqi@0: { aoqi@0: /** aoqi@0: * Gets the type of this element declaration. aoqi@0: * @return aoqi@0: * always non-null. aoqi@0: */ aoqi@0: XSType getType(); aoqi@0: aoqi@0: boolean isNillable(); aoqi@0: aoqi@0: /** aoqi@0: * Gets the substitution head of this element, if any. aoqi@0: * Otherwise null. aoqi@0: */ aoqi@0: XSElementDecl getSubstAffiliation(); aoqi@0: aoqi@0: /** aoqi@0: * Returns all the {@link XSIdentityConstraint}s in this element decl. aoqi@0: * aoqi@0: * @return aoqi@0: * never null, but can be empty. aoqi@0: */ aoqi@0: List getIdentityConstraints(); aoqi@0: aoqi@0: /** aoqi@0: * Checks the substitution excluded property of the schema component. aoqi@0: * aoqi@0: * IOW, this checks the value of the final attribute aoqi@0: * (plus finalDefault). aoqi@0: * aoqi@0: * @param method aoqi@0: * Possible values are {@link XSType#EXTENSION} or aoqi@0: * XSType.RESTRICTION. aoqi@0: */ aoqi@0: boolean isSubstitutionExcluded(int method); aoqi@0: aoqi@0: /** aoqi@0: * Checks the diallowed substitution property of the schema component. aoqi@0: * aoqi@0: * IOW, this checks the value of the block attribute aoqi@0: * (plus blockDefault). aoqi@0: * aoqi@0: * @param method aoqi@0: * Possible values are {@link XSType#EXTENSION}, aoqi@0: * XSType.RESTRICTION, or XSType.SUBSTITUTION aoqi@0: */ aoqi@0: boolean isSubstitutionDisallowed(int method); aoqi@0: aoqi@0: boolean isAbstract(); aoqi@0: aoqi@0: /** aoqi@0: * Returns the element declarations that can substitute aoqi@0: * this element. aoqi@0: * aoqi@0: *

aoqi@0: * IOW, this set returns all the element decls that satisfies aoqi@0: * aoqi@0: * the "Substitution Group OK" constraint. aoqi@0: * aoqi@0: * aoqi@0: * @return aoqi@0: * nun-null valid array. The return value always contains this element aoqi@0: * decl itself. aoqi@0: * aoqi@0: * @deprecated aoqi@0: * this method allocates a new array every time, so it could be aoqi@0: * inefficient when working with a large schema. Use aoqi@0: * {@link #getSubstitutables()} instead. aoqi@0: */ aoqi@0: XSElementDecl[] listSubstitutables(); aoqi@0: aoqi@0: /** aoqi@0: * Returns the element declarations that can substitute aoqi@0: * this element. aoqi@0: * aoqi@0: *

aoqi@0: * IOW, this set returns all the element decls that satisfies aoqi@0: * aoqi@0: * the "Substitution Group OK" constraint. aoqi@0: * aoqi@0: * aoqi@0: *

aoqi@0: * Note that the above clause does NOT check for aoqi@0: * abstract elements. So abstract elements may still show up aoqi@0: * in the returned set. aoqi@0: * aoqi@0: * @return aoqi@0: * nun-null unmodifiable list. aoqi@0: * The returned list always contains this element decl itself. aoqi@0: */ aoqi@0: Set getSubstitutables(); aoqi@0: aoqi@0: /** aoqi@0: * Returns true if this element declaration can be validly substituted aoqi@0: * by the given declaration. aoqi@0: * aoqi@0: *

aoqi@0: * Just a short cut of getSubstitutables().contain(e); aoqi@0: */ aoqi@0: boolean canBeSubstitutedBy(XSElementDecl e); aoqi@0: aoqi@0: // TODO: identitiy constraints aoqi@0: // TODO: scope aoqi@0: aoqi@0: XmlString getDefaultValue(); aoqi@0: XmlString getFixedValue(); aoqi@0: aoqi@0: /** aoqi@0: * Used for javadoc schema generation aoqi@0: * aoqi@0: * @return aoqi@0: * null if form attribute not present, aoqi@0: * true if form attribute present and set to qualified, aoqi@0: * false if form attribute present and set to unqualified. aoqi@0: */ aoqi@0: aoqi@0: Boolean getForm(); aoqi@0: }