src/share/jaxws_classes/com/sun/xml/internal/xsom/XSSimpleType.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/XSSimpleType.java	Wed Apr 27 01:27:09 2016 +0800
     1.3 @@ -0,0 +1,162 @@
     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.visitor.XSSimpleTypeFunction;
    1.32 +import com.sun.xml.internal.xsom.visitor.XSSimpleTypeVisitor;
    1.33 +
    1.34 +import java.util.List;
    1.35 +
    1.36 +/**
    1.37 + * Simple type.
    1.38 + *
    1.39 + * @author
    1.40 + *  Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
    1.41 + */
    1.42 +public interface XSSimpleType extends XSType, XSContentType
    1.43 +{
    1.44 +    /**
    1.45 +     * Gets the base type as XSSimpleType.
    1.46 +     *
    1.47 +     * Equivalent to
    1.48 +     * <code>
    1.49 +     * (XSSimpleType)getBaseType()
    1.50 +     * </code>
    1.51 +     * Since this is a simple type, we know that the base type
    1.52 +     * is also a simple type.
    1.53 +     *
    1.54 +     * The only exception is xs:anySimpleType, which has xs:anyType
    1.55 +     * as the base type.
    1.56 +     *
    1.57 +     * @return
    1.58 +     *      null if this is xs:anySimpleType. Otherwise non-null.
    1.59 +     */
    1.60 +    XSSimpleType getSimpleBaseType();
    1.61 +
    1.62 +    /**
    1.63 +     * Gets the variety of this simple type.
    1.64 +     */
    1.65 +    XSVariety getVariety();
    1.66 +
    1.67 +    /**
    1.68 +     * Gets the ancestor primitive {@link XSSimpleType} if
    1.69 +     * this type is {@link XSVariety#ATOMIC atomic}.
    1.70 +     *
    1.71 +     * @return
    1.72 +     *      null otherwise.
    1.73 +     */
    1.74 +    XSSimpleType getPrimitiveType();
    1.75 +
    1.76 +    /**
    1.77 +     * Returns true if this is a primitive built-in simple type
    1.78 +     * (that directly derives from xs:anySimpleType, by definition.)
    1.79 +     */
    1.80 +    boolean isPrimitive();
    1.81 +
    1.82 +    /**
    1.83 +     * Gets the nearest ancestor {@link XSListSimpleType} (including itself)
    1.84 +     * if the variety of this type is {@link XSVariety#LIST list}.
    1.85 +     *
    1.86 +     * @return otherwise return null
    1.87 +     */
    1.88 +    XSListSimpleType getBaseListType();
    1.89 +
    1.90 +    /**
    1.91 +     * Gets the nearest ancestor {@link XSUnionSimpleType} (including itself)
    1.92 +     * if the variety of this type is {@link XSVariety#UNION union}.
    1.93 +     *
    1.94 +     * @return otherwise return null
    1.95 +     */
    1.96 +    XSUnionSimpleType getBaseUnionType();
    1.97 +
    1.98 +    /**
    1.99 +     * Returns true if this type definition is marked as 'final'
   1.100 +     * with respect to the given {@link XSVariety}.
   1.101 +     *
   1.102 +     * @return
   1.103 +     *      true if the type is marked final.
   1.104 +     */
   1.105 +    boolean isFinal(XSVariety v);
   1.106 +
   1.107 +    /**
   1.108 +     * If this {@link XSSimpleType} is redefined by another simple type,
   1.109 +     * return that component.
   1.110 +     *
   1.111 +     * @return null
   1.112 +     *      if this component has not been redefined.
   1.113 +     */
   1.114 +    public XSSimpleType getRedefinedBy();
   1.115 +
   1.116 +    /**
   1.117 +     * Gets the effective facet object of the given name.
   1.118 +     *
   1.119 +     * <p>
   1.120 +     * For example, if a simple type "foo" is derived from
   1.121 +     * xs:string by restriction with the "maxLength" facet and
   1.122 +     * another simple type "bar" is derived from "foo" by
   1.123 +     * restriction with another "maxLength" facet, this method
   1.124 +     * will return the latter one, because that is the most
   1.125 +     * restrictive, effective facet.
   1.126 +     *
   1.127 +     * <p>
   1.128 +     * For those facets that can have multiple values
   1.129 +     * (pattern facets and enumeration facets), this method
   1.130 +     * will return only the first one.
   1.131 +     * TODO: allow clients to access all of them by some means.
   1.132 +     *
   1.133 +     * @return
   1.134 +     *      If this datatype has a facet of the given name,
   1.135 +     *      return that object. If the facet is not specified
   1.136 +     *      anywhere in its derivation chain, null will be returned.
   1.137 +     */
   1.138 +    XSFacet getFacet( String name );
   1.139 +
   1.140 +    /**
   1.141 +     * For multi-valued facets (enumeration and pattern), obtain all values.
   1.142 +     *
   1.143 +     * @see #getFacet(String)
   1.144 +     *
   1.145 +     * @return
   1.146 +     *      can be empty but never null.
   1.147 +     */
   1.148 +    List<XSFacet> getFacets( String name );
   1.149 +
   1.150 +
   1.151 +
   1.152 +    void visit( XSSimpleTypeVisitor visitor );
   1.153 +    <T> T apply( XSSimpleTypeFunction<T> function );
   1.154 +
   1.155 +    /** Returns true if <code>this instanceof XSRestrictionSimpleType</code>. */
   1.156 +    boolean isRestriction();
   1.157 +    /** Returns true if <code>this instanceof XSListSimpleType</code>. */
   1.158 +    boolean isList();
   1.159 +    /** Returns true if <code>this instanceof XSUnionSimpleType</code>. */
   1.160 +    boolean isUnion();
   1.161 +
   1.162 +    XSRestrictionSimpleType asRestriction();
   1.163 +    XSListSimpleType asList();
   1.164 +    XSUnionSimpleType asUnion();
   1.165 +}

mercurial