xscomplextypedecl.java

来自「JAVA的一些源码 JAVA2 STANDARD EDITION DEVELO」· Java 代码 · 共 490 行 · 第 1/2 页

JAVA
490
字号
            ancestorNS.equals(SchemaSymbols.URI_SCHEMAFORSCHEMA) &&            ancestorName.equals(SchemaSymbols.ATTVAL_ANYTYPE)) {            return true;        }        // recursively get base, and compare it with ancestor        XSTypeDefinition type = this;        while (!(ancestorName.equals(type.getName()) &&                 ((ancestorNS == null && type.getNamespace() == null) ||                  (ancestorNS != null && ancestorNS.equals(type.getNamespace())))) &&   // compare with ancestor               type != SchemaGrammar.fAnySimpleType &&  // reached anySimpleType               type != SchemaGrammar.fAnyType) {        // reached anyType            if( derivationMethod!=0 ) {                if( type instanceof XSComplexTypeDefinition ) {                    switch( ((XSComplexTypeDefinition)type).getDerivationMethod() ) {                    case XSConstants.DERIVATION_EXTENSION:                        if( (derivationMethod&TypeInfo.DERIVATION_EXTENSION) == 0 )                            return false;                        break;                    case XSConstants.DERIVATION_RESTRICTION:                        if( (derivationMethod&TypeInfo.DERIVATION_RESTRICTION) == 0 )                            return false;                        break;                    }                } else                 if( type instanceof XSSimpleTypeDefinition ) {                    // broken (but then the spec is broken, so what do you expect!) FIXME.                    switch( ((XSSimpleTypeDefinition)type).getVariety()) {                    case XSSimpleTypeDefinition.VARIETY_ATOMIC:                        if( (derivationMethod&TypeInfo.DERIVATION_RESTRICTION) == 0 )                            return false;                        break;                   case XSSimpleTypeDefinition.VARIETY_LIST:                       if( (derivationMethod&TypeInfo.DERIVATION_LIST) == 0 )                           return false;                       break;                   case XSSimpleTypeDefinition.VARIETY_UNION:                       if( (derivationMethod&TypeInfo.DERIVATION_UNION) == 0 )                           return false;                       break;                  }                }            }            type = (XSTypeDefinition)type.getBaseType();        }        return type != SchemaGrammar.fAnySimpleType &&        type != SchemaGrammar.fAnyType;    }    public void reset(){        fName = null;        fTargetNamespace = null;        fBaseType = null;        fDerivedBy = XSConstants.DERIVATION_RESTRICTION;        fFinal = XSConstants.DERIVATION_NONE;        fBlock = XSConstants.DERIVATION_NONE;        fMiscFlags = 0;        // reset attribute group        fAttrGrp.reset();        fContentType = CONTENTTYPE_EMPTY;        fXSSimpleType = null;        fParticle = null;        fCMValidator = null;        if(fAnnotations != null) {            // help out the garbage collector            fAnnotations.clear();        }        fAnnotations = null;    }    /**     * Get the type of the object, i.e ELEMENT_DECLARATION.     */    public short getType() {        return XSConstants.TYPE_DEFINITION;    }    /**     * The <code>name</code> of this <code>XSObject</code> depending on the     * <code>XSObject</code> type.     */    public String getName() {        return getAnonymous() ? null : fName;    }    /**     * A boolean that specifies if the type definition is anonymous.     * Convenience attribute. This is a field is not part of     * XML Schema component model.     */    public boolean getAnonymous() {        return((fMiscFlags & CT_IS_ANONYMOUS) != 0);    }    /**     * The namespace URI of this node, or <code>null</code> if it is     * unspecified.  defines how a namespace URI is attached to schema     * components.     */    public String getNamespace() {        return fTargetNamespace;    }    /**     * {base type definition} Either a simple type definition or a complex     * type definition.     */    public XSTypeDefinition getBaseType() {        return fBaseType;    }    /**     * {derivation method} Either extension or restriction. The valid constant     * value for this <code>XSConstants</code> EXTENTION, RESTRICTION.     */    public short getDerivationMethod() {        return fDerivedBy;    }    /**     * {final} For complex type definition it is a subset of {extension,     * restriction}. For simple type definition it is a subset of     * {extension, list, restriction, union}.     * @param derivation  Extension, restriction, list, union constants     *   (defined in <code>XSConstants</code>).     * @return True if derivation is in the final set, otherwise false.     */    public boolean isFinal(short derivation) {        return (fFinal & derivation) != 0;    }    /**     * {final} For complex type definition it is a subset of {extension, restriction}.     *     * @return A bit flag that represents:     *         {extension, restriction) or none for complexTypes;     *         {extension, list, restriction, union} or none for simpleTypes;     */    public short getFinal() {        return fFinal;    }    /**     * {abstract} A boolean. Complex types for which {abstract} is true must     * not be used as the {type definition} for the validation of element     * information items.     */    public boolean getAbstract() {        return((fMiscFlags & CT_IS_ABSTRACT) != 0);    }    /**     *  {attribute uses} A set of attribute uses.     */    public XSObjectList getAttributeUses() {        return fAttrGrp.getAttributeUses();    }    /**     * {attribute wildcard} Optional. A wildcard.     */    public XSWildcard getAttributeWildcard() {        return fAttrGrp.getAttributeWildcard();    }    /**     * {content type} One of empty, a simple type definition (see     * <code>simpleType</code>, or mixed, element-only (see     * <code>cmParticle</code>).     */    public short getContentType() {        return fContentType;    }    /**     * A simple type definition corresponding to simple content model,     * otherwise <code>null</code>     */    public XSSimpleTypeDefinition getSimpleType() {        return fXSSimpleType;    }    /**     * A particle for mixed or element-only content model, otherwise     * <code>null</code>     */    public XSParticle getParticle() {        return fParticle;    }    /**     * {prohibited substitutions} A subset of {extension, restriction}.     * @param prohibited  extention or restriction constants (defined in     *   <code>XSConstants</code>).     * @return True if prohibited is a prohibited substitution, otherwise     *   false.     */    public boolean isProhibitedSubstitution(short prohibited) {        return (fBlock & prohibited) != 0;    }    /**     * {prohibited substitutions}     *     * @return A bit flag corresponding to prohibited substitutions     */    public short getProhibitedSubstitutions() {        return fBlock;    }    /**     * Optional. Annotation.     */    public XSObjectList getAnnotations() {        return fAnnotations;    }        /* (non-Javadoc)     * @see com.sun.org.apache.xerces.internal.xs.XSComplexTypeDefinition#getAttributeUse(java.lang.String, java.lang.String)     */    public XSAttributeUse getAttributeUse(String namespace, String name) {         return fAttrGrp.getAttributeUse(namespace, name);    }        /**     * @see com.sun.org.apache.xerces.internal.impl.xs.psvi.XSObject#getNamespaceItem()     */    public XSNamespaceItem getNamespaceItem() {        // REVISIT: implement    	return null;    }    public String getTypeNamespace() {        return getNamespace();    }        public boolean isDerivedFrom(String typeNamespace,  String typeName, int derivationMethod) {        return derivedFrom(typeNamespace,typeName,(short)derivationMethod);    }} // class XSComplexTypeDecl

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?