src/share/jaxws_classes/com/sun/xml/internal/xsom/XSComponent.java

changeset 0
373ffda63c9a
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/xsom/XSComponent.java	Wed Apr 27 01:27:09 2016 +0800
     1.3 @@ -0,0 +1,170 @@
     1.4 +/*
     1.5 + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Oracle designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Oracle in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 + * or visit www.oracle.com if you need additional information or have any
    1.26 + * questions.
    1.27 + */
    1.28 +
    1.29 +package com.sun.xml.internal.xsom;
    1.30 +
    1.31 +import com.sun.xml.internal.xsom.parser.SchemaDocument;
    1.32 +import com.sun.xml.internal.xsom.visitor.XSFunction;
    1.33 +import com.sun.xml.internal.xsom.visitor.XSVisitor;
    1.34 +import org.xml.sax.Locator;
    1.35 +
    1.36 +import javax.xml.namespace.NamespaceContext;
    1.37 +import java.util.List;
    1.38 +import java.util.Collection;
    1.39 +
    1.40 +/**
    1.41 + * Base interface for all the schema components.
    1.42 + *
    1.43 + * @author
    1.44 + *  Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
    1.45 + */
    1.46 +public interface XSComponent
    1.47 +{
    1.48 +    /** Gets the annotation associated to this component, if any. */
    1.49 +    XSAnnotation getAnnotation();
    1.50 +
    1.51 +    /**
    1.52 +     * Works like {@link #getAnnotation()}, but allow a new empty {@link XSAnnotation} to be created
    1.53 +     * if not exist.
    1.54 +     *
    1.55 +     * @param createIfNotExist
    1.56 +     *      true to create a new {@link XSAnnotation} if it doesn't exist already.
    1.57 +     *      false to make this method behavel like {@link #getAnnotation()}.
    1.58 +     *
    1.59 +     * @return
    1.60 +     *      null if <tt>createIfNotExist==false</tt> and annotation didn't exist.
    1.61 +     *      Otherwise non-null.
    1.62 +     */
    1.63 +    XSAnnotation getAnnotation(boolean createIfNotExist);
    1.64 +
    1.65 +    /**
    1.66 +     * Gets the foreign attributes on this schema component.
    1.67 +     *
    1.68 +     * <p>
    1.69 +     * In general, a schema component may match multiple elements
    1.70 +     * in a schema document, and those elements can individually
    1.71 +     * carry foreign attributes.
    1.72 +     *
    1.73 +     * <p>
    1.74 +     * This method returns a list of {@link ForeignAttributes}, where
    1.75 +     * each {@link ForeignAttributes} object represent foreign attributes
    1.76 +     * on one element.
    1.77 +     *
    1.78 +     * @return
    1.79 +     *      can be an empty list but never be null.
    1.80 +     */
    1.81 +    List<? extends ForeignAttributes> getForeignAttributes();
    1.82 +
    1.83 +    /**
    1.84 +     * Gets the foreign attribute of the given name, or null if not found.
    1.85 +     *
    1.86 +     * <p>
    1.87 +     * If multiple occurences of the same attribute is found,
    1.88 +     * this method returns the first one.
    1.89 +     *
    1.90 +     * @see #getForeignAttributes()
    1.91 +     */
    1.92 +    String getForeignAttribute(String nsUri, String localName);
    1.93 +
    1.94 +    /**
    1.95 +     * Gets the locator that indicates the source location where
    1.96 +     * this component is created from, or null if no information is
    1.97 +     * available.
    1.98 +     */
    1.99 +    Locator getLocator();
   1.100 +
   1.101 +    /**
   1.102 +     * Gets a reference to the {@link XSSchema} object to which this component
   1.103 +     * belongs.
   1.104 +     * <p>
   1.105 +     * In case of <code>XSEmpty</code> component, this method
   1.106 +     * returns null since there is no owner component.
   1.107 +     */
   1.108 +    XSSchema getOwnerSchema();
   1.109 +
   1.110 +    /**
   1.111 +     * Gets the root schema set that includes this component.
   1.112 +     *
   1.113 +     * <p>
   1.114 +     * In case of <code>XSEmpty</code> component, this method
   1.115 +     * returns null since there is no owner component.
   1.116 +     */
   1.117 +    XSSchemaSet getRoot();
   1.118 +
   1.119 +    /**
   1.120 +     * Gets the {@link SchemaDocument} that indicates which document this component
   1.121 +     * was defined in.
   1.122 +     *
   1.123 +     * @return
   1.124 +     *      null for components that are built-in to XML Schema, such
   1.125 +     *      as anyType, or "empty" {@link XSContentType}. This method also
   1.126 +     *      returns null for {@link XSSchema}.
   1.127 +     *      For all other user-defined
   1.128 +     *      components this method returns non-null, even if they are local.
   1.129 +     */
   1.130 +    SchemaDocument getSourceDocument();
   1.131 +
   1.132 +    /**
   1.133 +     * Evaluates a schema component designator against this schema component
   1.134 +     * and returns the resulting schema components.
   1.135 +     *
   1.136 +     * @throws IllegalArgumentException
   1.137 +     *      if SCD is syntactically incorrect.
   1.138 +     *
   1.139 +     * @param scd
   1.140 +     *      Schema component designator. See {@link SCD} for more details.
   1.141 +     * @param nsContext
   1.142 +     *      The namespace context in which SCD is evaluated. Cannot be null.
   1.143 +     * @return
   1.144 +     *      Can be empty but never null.
   1.145 +     */
   1.146 +    Collection<XSComponent> select(String scd, NamespaceContext nsContext);
   1.147 +
   1.148 +    /**
   1.149 +     * Evaluates a schema component designator against this schema component
   1.150 +     * and returns the first resulting schema component.
   1.151 +     *
   1.152 +     * @throws IllegalArgumentException
   1.153 +     *      if SCD is syntactically incorrect.
   1.154 +     *
   1.155 +     * @param scd
   1.156 +     *      Schema component designator. See {@link SCD} for more details.
   1.157 +     * @param nsContext
   1.158 +     *      The namespace context in which SCD is evaluated. Cannot be null.
   1.159 +     * @return
   1.160 +     *      null if the SCD didn't match anything. If the SCD matched more than one node,
   1.161 +     *      the first one will be returned.
   1.162 +     */
   1.163 +    XSComponent selectSingle(String scd, NamespaceContext nsContext);
   1.164 +
   1.165 +    /**
   1.166 +     * Accepts a visitor.
   1.167 +     */
   1.168 +    void visit( XSVisitor visitor );
   1.169 +    /**
   1.170 +     * Accepts a functor.
   1.171 +     */
   1.172 +    <T> T apply( XSFunction<T> function );
   1.173 +}

mercurial