com.sun.xml.xsom.XSType Maven / Gradle / Ivy
/*
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package com.sun.xml.xsom;
/**
* Base interface for {@link XSComplexType} and {@link XSSimpleType}.
*
* @author
* Kohsuke Kawaguchi ([email protected])
*/
public interface XSType extends XSDeclaration {
/**
* Returns the base type of this type.
*
* Note that if this type represents {@code xs:anyType}, this method returns itself.
* This is awkward as an API, but it follows the schema specification.
*
* @return always non-null.
*/
XSType getBaseType();
int EXTENSION = 1;
int RESTRICTION = 2;
int SUBSTITUTION = 4;
int getDerivationMethod();
/** Returns true if {@code this instanceof XSSimpleType}. */
boolean isSimpleType();
/** Returns true if {@code this instanceof XSComplexType}. */
boolean isComplexType();
/**
* Lists up types that can substitute this type by using xsi:type.
* Includes this type itself.
*
* This method honors the block flag.
*/
XSType[] listSubstitutables();
/**
* If this is redefined by another type,
* return that component.
*
* @return null
* if this component has not been redefined.
*/
XSType getRedefinedBy();
/**
* Returns the number of complex types that redefine this component.
*
*
* For example, if A is redefined by B and B is redefined by C,
* A.getRedefinedCount()==2, B.getRedefinedCount()==1, and
* C.getRedefinedCount()==0.
*/
int getRedefinedCount();
/** Casts this object to XSSimpleType if possible, otherwise returns null. */
XSSimpleType asSimpleType();
/** Casts this object to XSComplexType if possible, otherwise returns null. */
XSComplexType asComplexType();
/**
* Returns true if this type is derived from the specified type.
*
*
* Note that {@code t.isDerivedFrom(t)} returns true.
*/
boolean isDerivedFrom( XSType t );
}