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

Thu, 12 Oct 2017 19:44:07 +0800

author
aoqi
date
Thu, 12 Oct 2017 19:44:07 +0800
changeset 760
e530533619ec
parent 0
373ffda63c9a
permissions
-rw-r--r--

merge

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation. Oracle designates this
aoqi@0 8 * particular file as subject to the "Classpath" exception as provided
aoqi@0 9 * by Oracle in the LICENSE file that accompanied this code.
aoqi@0 10 *
aoqi@0 11 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 14 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 15 * accompanied this code).
aoqi@0 16 *
aoqi@0 17 * You should have received a copy of the GNU General Public License version
aoqi@0 18 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 20 *
aoqi@0 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 22 * or visit www.oracle.com if you need additional information or have any
aoqi@0 23 * questions.
aoqi@0 24 */
aoqi@0 25
aoqi@0 26 package com.sun.xml.internal.xsom;
aoqi@0 27
aoqi@0 28 import com.sun.xml.internal.xsom.visitor.XSSimpleTypeFunction;
aoqi@0 29 import com.sun.xml.internal.xsom.visitor.XSSimpleTypeVisitor;
aoqi@0 30
aoqi@0 31 import java.util.List;
aoqi@0 32
aoqi@0 33 /**
aoqi@0 34 * Simple type.
aoqi@0 35 *
aoqi@0 36 * @author
aoqi@0 37 * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
aoqi@0 38 */
aoqi@0 39 public interface XSSimpleType extends XSType, XSContentType
aoqi@0 40 {
aoqi@0 41 /**
aoqi@0 42 * Gets the base type as XSSimpleType.
aoqi@0 43 *
aoqi@0 44 * Equivalent to
aoqi@0 45 * <code>
aoqi@0 46 * (XSSimpleType)getBaseType()
aoqi@0 47 * </code>
aoqi@0 48 * Since this is a simple type, we know that the base type
aoqi@0 49 * is also a simple type.
aoqi@0 50 *
aoqi@0 51 * The only exception is xs:anySimpleType, which has xs:anyType
aoqi@0 52 * as the base type.
aoqi@0 53 *
aoqi@0 54 * @return
aoqi@0 55 * null if this is xs:anySimpleType. Otherwise non-null.
aoqi@0 56 */
aoqi@0 57 XSSimpleType getSimpleBaseType();
aoqi@0 58
aoqi@0 59 /**
aoqi@0 60 * Gets the variety of this simple type.
aoqi@0 61 */
aoqi@0 62 XSVariety getVariety();
aoqi@0 63
aoqi@0 64 /**
aoqi@0 65 * Gets the ancestor primitive {@link XSSimpleType} if
aoqi@0 66 * this type is {@link XSVariety#ATOMIC atomic}.
aoqi@0 67 *
aoqi@0 68 * @return
aoqi@0 69 * null otherwise.
aoqi@0 70 */
aoqi@0 71 XSSimpleType getPrimitiveType();
aoqi@0 72
aoqi@0 73 /**
aoqi@0 74 * Returns true if this is a primitive built-in simple type
aoqi@0 75 * (that directly derives from xs:anySimpleType, by definition.)
aoqi@0 76 */
aoqi@0 77 boolean isPrimitive();
aoqi@0 78
aoqi@0 79 /**
aoqi@0 80 * Gets the nearest ancestor {@link XSListSimpleType} (including itself)
aoqi@0 81 * if the variety of this type is {@link XSVariety#LIST list}.
aoqi@0 82 *
aoqi@0 83 * @return otherwise return null
aoqi@0 84 */
aoqi@0 85 XSListSimpleType getBaseListType();
aoqi@0 86
aoqi@0 87 /**
aoqi@0 88 * Gets the nearest ancestor {@link XSUnionSimpleType} (including itself)
aoqi@0 89 * if the variety of this type is {@link XSVariety#UNION union}.
aoqi@0 90 *
aoqi@0 91 * @return otherwise return null
aoqi@0 92 */
aoqi@0 93 XSUnionSimpleType getBaseUnionType();
aoqi@0 94
aoqi@0 95 /**
aoqi@0 96 * Returns true if this type definition is marked as 'final'
aoqi@0 97 * with respect to the given {@link XSVariety}.
aoqi@0 98 *
aoqi@0 99 * @return
aoqi@0 100 * true if the type is marked final.
aoqi@0 101 */
aoqi@0 102 boolean isFinal(XSVariety v);
aoqi@0 103
aoqi@0 104 /**
aoqi@0 105 * If this {@link XSSimpleType} is redefined by another simple type,
aoqi@0 106 * return that component.
aoqi@0 107 *
aoqi@0 108 * @return null
aoqi@0 109 * if this component has not been redefined.
aoqi@0 110 */
aoqi@0 111 public XSSimpleType getRedefinedBy();
aoqi@0 112
aoqi@0 113 /**
aoqi@0 114 * Gets the effective facet object of the given name.
aoqi@0 115 *
aoqi@0 116 * <p>
aoqi@0 117 * For example, if a simple type "foo" is derived from
aoqi@0 118 * xs:string by restriction with the "maxLength" facet and
aoqi@0 119 * another simple type "bar" is derived from "foo" by
aoqi@0 120 * restriction with another "maxLength" facet, this method
aoqi@0 121 * will return the latter one, because that is the most
aoqi@0 122 * restrictive, effective facet.
aoqi@0 123 *
aoqi@0 124 * <p>
aoqi@0 125 * For those facets that can have multiple values
aoqi@0 126 * (pattern facets and enumeration facets), this method
aoqi@0 127 * will return only the first one.
aoqi@0 128 * TODO: allow clients to access all of them by some means.
aoqi@0 129 *
aoqi@0 130 * @return
aoqi@0 131 * If this datatype has a facet of the given name,
aoqi@0 132 * return that object. If the facet is not specified
aoqi@0 133 * anywhere in its derivation chain, null will be returned.
aoqi@0 134 */
aoqi@0 135 XSFacet getFacet( String name );
aoqi@0 136
aoqi@0 137 /**
aoqi@0 138 * For multi-valued facets (enumeration and pattern), obtain all values.
aoqi@0 139 *
aoqi@0 140 * @see #getFacet(String)
aoqi@0 141 *
aoqi@0 142 * @return
aoqi@0 143 * can be empty but never null.
aoqi@0 144 */
aoqi@0 145 List<XSFacet> getFacets( String name );
aoqi@0 146
aoqi@0 147
aoqi@0 148
aoqi@0 149 void visit( XSSimpleTypeVisitor visitor );
aoqi@0 150 <T> T apply( XSSimpleTypeFunction<T> function );
aoqi@0 151
aoqi@0 152 /** Returns true if <code>this instanceof XSRestrictionSimpleType</code>. */
aoqi@0 153 boolean isRestriction();
aoqi@0 154 /** Returns true if <code>this instanceof XSListSimpleType</code>. */
aoqi@0 155 boolean isList();
aoqi@0 156 /** Returns true if <code>this instanceof XSUnionSimpleType</code>. */
aoqi@0 157 boolean isUnion();
aoqi@0 158
aoqi@0 159 XSRestrictionSimpleType asRestriction();
aoqi@0 160 XSListSimpleType asList();
aoqi@0 161 XSUnionSimpleType asUnion();
aoqi@0 162 }

mercurial