Java Code Examples for com.sun.xml.internal.xsom.XSComplexType#getBaseType()

The following examples show how to use com.sun.xml.internal.xsom.XSComplexType#getBaseType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultiWildcardComplexTypeBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public boolean isApplicable(XSComplexType ct) {
    if (!bgmBuilder.model.options.contentForWildcard) {
        return false;
    }
    XSType bt = ct.getBaseType();
    if (bt ==schemas.getAnyType() && ct.getContentType() != null) {
        XSParticle part = ct.getContentType().asParticle();
        if ((part != null) && (part.getTerm().isModelGroup())) {
            XSParticle[] parts = part.getTerm().asModelGroup().getChildren();
            int wildcardCount = 0;
            int i = 0;
            while ((i < parts.length) && (wildcardCount <= 1)) {
                if (parts[i].getTerm().isWildcard()) {
                    wildcardCount += 1;
                }
                i++;
            }
            return (wildcardCount > 1);
        }
    }
    return false;
}
 
Example 2
Source File: MixedExtendedComplexTypeBuilder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public boolean isApplicable(XSComplexType ct) {

        if (!bgmBuilder.isGenerateMixedExtensions()) return false;

        XSType bt = ct.getBaseType();
        if (bt.isComplexType() &&
            bt.asComplexType().isMixed() &&
            ct.isMixed() &&
            ct.getDerivationMethod()==XSType.EXTENSION &&
            ct.getContentType().asParticle() != null &&
            ct.getExplicitContent().asEmpty() == null
            )  {
                return true;
        }

        return false;
    }
 
Example 3
Source File: AbstractExtendedComplexTypeBuilder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Looks for the derivation chain t_1 > t_2 > ... > t
 * and find t_i such that t_i derives by restriction but
 * for every j>i, t_j derives by extension.
 *
 * @return null
 *      If there's no such t_i or if t_i is any type.
 */
protected XSComplexType getLastRestrictedType(XSComplexType t) {
    if (t.getBaseType() == schemas.getAnyType()) {
        return null;   // we don't count the restriction from anyType
    }
    if (t.getDerivationMethod() == XSType.RESTRICTION) {
        return t;
    }

    XSComplexType baseType = t.getBaseType().asComplexType();
    if (baseType != null) {
        return getLastRestrictedType(baseType);
    } else {
        return null;
    }
}
 
Example 4
Source File: MultiWildcardComplexTypeBuilder.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public boolean isApplicable(XSComplexType ct) {
    if (!bgmBuilder.model.options.contentForWildcard) {
        return false;
    }
    XSType bt = ct.getBaseType();
    if (bt ==schemas.getAnyType() && ct.getContentType() != null) {
        XSParticle part = ct.getContentType().asParticle();
        if ((part != null) && (part.getTerm().isModelGroup())) {
            XSParticle[] parts = part.getTerm().asModelGroup().getChildren();
            int wildcardCount = 0;
            int i = 0;
            while ((i < parts.length) && (wildcardCount <= 1)) {
                if (parts[i].getTerm().isWildcard()) {
                    wildcardCount += 1;
                }
                i++;
            }
            return (wildcardCount > 1);
        }
    }
    return false;
}
 
Example 5
Source File: AbstractExtendedComplexTypeBuilder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Looks for the derivation chain t_1 > t_2 > ... > t
 * and find t_i such that t_i derives by restriction but
 * for every j>i, t_j derives by extension.
 *
 * @return null
 *      If there's no such t_i or if t_i is any type.
 */
protected XSComplexType getLastRestrictedType(XSComplexType t) {
    if (t.getBaseType() == schemas.getAnyType()) {
        return null;   // we don't count the restriction from anyType
    }
    if (t.getDerivationMethod() == XSType.RESTRICTION) {
        return t;
    }

    XSComplexType baseType = t.getBaseType().asComplexType();
    if (baseType != null) {
        return getLastRestrictedType(baseType);
    } else {
        return null;
    }
}
 
Example 6
Source File: MixedExtendedComplexTypeBuilder.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public boolean isApplicable(XSComplexType ct) {

        if (!bgmBuilder.isGenerateMixedExtensions()) return false;

        XSType bt = ct.getBaseType();
        if (bt.isComplexType() &&
            bt.asComplexType().isMixed() &&
            ct.isMixed() &&
            ct.getDerivationMethod()==XSType.EXTENSION &&
            ct.getContentType().asParticle() != null &&
            ct.getExplicitContent().asEmpty() == null
            )  {
                return true;
        }

        return false;
    }
 
Example 7
Source File: MixedExtendedComplexTypeBuilder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public boolean isApplicable(XSComplexType ct) {

        if (!bgmBuilder.isGenerateMixedExtensions()) return false;

        XSType bt = ct.getBaseType();
        if (bt.isComplexType() &&
            bt.asComplexType().isMixed() &&
            ct.isMixed() &&
            ct.getDerivationMethod()==XSType.EXTENSION &&
            ct.getContentType().asParticle() != null &&
            ct.getExplicitContent().asEmpty() == null
            )  {
                return true;
        }

        return false;
    }
 
Example 8
Source File: ChoiceContentComplexTypeBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public boolean isApplicable(XSComplexType ct) {
    if( !bgmBuilder.getGlobalBinding().isChoiceContentPropertyEnabled() )
        return false;

    if( ct.getBaseType()!=schemas.getAnyType() )
        // My reading of the spec is that if a complex type is
        // derived from another complex type by extension,
        // its top level model group is always a sequence
        // that combines the base type content model and
        // the extension defined in the new complex type.
        return false;

    XSParticle p = ct.getContentType().asParticle();
    if(p==null)
        return false;

    XSModelGroup mg = getTopLevelModelGroup(p);

    if( mg.getCompositor()!=XSModelGroup.CHOICE )
        return false;

    if( p.isRepeated() )
        return false;

    return true;
}
 
Example 9
Source File: MixedExtendedComplexTypeBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public boolean isApplicable(XSComplexType ct) {

        if (!bgmBuilder.isGenerateMixedExtensions()) return false;

        XSType bt = ct.getBaseType();
        if (bt.isComplexType() &&
            bt.asComplexType().isMixed() &&
            ct.isMixed() &&
            ct.getDerivationMethod()==XSType.EXTENSION &&
            ct.getContentType().asParticle() != null &&
            ct.getExplicitContent().asEmpty() == null
            )  {
                return true;
        }

        return false;
    }
 
Example 10
Source File: MixedExtendedComplexTypeBuilder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public boolean isApplicable(XSComplexType ct) {

        if (!bgmBuilder.isGenerateMixedExtensions()) return false;

        XSType bt = ct.getBaseType();
        if (bt.isComplexType() &&
            bt.asComplexType().isMixed() &&
            ct.isMixed() &&
            ct.getDerivationMethod()==XSType.EXTENSION &&
            ct.getContentType().asParticle() != null &&
            ct.getExplicitContent().asEmpty() == null
            )  {
                return true;
        }

        return false;
    }
 
Example 11
Source File: ComplexTypeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public List<XSComplexType> getSubtypes() {
    ArrayList subtypeList = new ArrayList();
    Iterator<XSComplexType> cTypes = getRoot().iterateComplexTypes();
    while (cTypes.hasNext()) {
        XSComplexType cType= cTypes.next();
        XSType base = cType.getBaseType();
        if ((base != null) && (base.equals(this))) {
            subtypeList.add(cType);
        }
    }
    return subtypeList;
}
 
Example 12
Source File: ComplexTypeImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public List<XSComplexType> getSubtypes() {
    ArrayList subtypeList = new ArrayList();
    Iterator<XSComplexType> cTypes = getRoot().iterateComplexTypes();
    while (cTypes.hasNext()) {
        XSComplexType cType= cTypes.next();
        XSType base = cType.getBaseType();
        if ((base != null) && (base.equals(this))) {
            subtypeList.add(cType);
        }
    }
    return subtypeList;
}
 
Example 13
Source File: ComplexTypeImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public List<XSComplexType> getSubtypes() {
    ArrayList subtypeList = new ArrayList();
    Iterator<XSComplexType> cTypes = getRoot().iterateComplexTypes();
    while (cTypes.hasNext()) {
        XSComplexType cType= cTypes.next();
        XSType base = cType.getBaseType();
        if ((base != null) && (base.equals(this))) {
            subtypeList.add(cType);
        }
    }
    return subtypeList;
}
 
Example 14
Source File: ExtendedComplexTypeBuilder.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public boolean isApplicable(XSComplexType ct) {
    XSType baseType = ct.getBaseType();
    return baseType!=schemas.getAnyType()
        &&  baseType.isComplexType()
        &&  ct.getDerivationMethod()==XSType.EXTENSION;
}
 
Example 15
Source File: RestrictedComplexTypeBuilder.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public boolean isApplicable(XSComplexType ct) {
    XSType baseType = ct.getBaseType();
    return baseType!=schemas.getAnyType()
        &&  baseType.isComplexType()
        &&  ct.getDerivationMethod()==XSType.RESTRICTION;
}
 
Example 16
Source File: ExtendedComplexTypeBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public boolean isApplicable(XSComplexType ct) {
    XSType baseType = ct.getBaseType();
    return baseType!=schemas.getAnyType()
        &&  baseType.isComplexType()
        &&  ct.getDerivationMethod()==XSType.EXTENSION;
}
 
Example 17
Source File: RestrictedComplexTypeBuilder.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public boolean isApplicable(XSComplexType ct) {
    XSType baseType = ct.getBaseType();
    return baseType!=schemas.getAnyType()
        &&  baseType.isComplexType()
        &&  ct.getDerivationMethod()==XSType.RESTRICTION;
}
 
Example 18
Source File: FreshComplexTypeBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public boolean isApplicable(XSComplexType ct) {
    return ct.getBaseType()==schemas.getAnyType()
        &&  !ct.isMixed();  // not mixed
}
 
Example 19
Source File: RestrictedComplexTypeBuilder.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public boolean isApplicable(XSComplexType ct) {
    XSType baseType = ct.getBaseType();
    return baseType!=schemas.getAnyType()
        &&  baseType.isComplexType()
        &&  ct.getDerivationMethod()==XSType.RESTRICTION;
}
 
Example 20
Source File: RestrictedComplexTypeBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public boolean isApplicable(XSComplexType ct) {
    XSType baseType = ct.getBaseType();
    return baseType!=schemas.getAnyType()
        &&  baseType.isComplexType()
        &&  ct.getDerivationMethod()==XSType.RESTRICTION;
}