com.sun.xml.internal.xsom.XSModelGroup Java Examples

The following examples show how to use com.sun.xml.internal.xsom.XSModelGroup. 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: AbstractMappingImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private boolean containingChoice(CClassInfo typeBean) {
    XSComponent component = typeBean.getSchemaComponent();
    if (component instanceof XSComplexType) {
        XSContentType contentType = ((XSComplexType) component).getContentType();
        XSParticle particle = contentType.asParticle();
        if (particle != null) {
            XSTerm term = particle.getTerm();
            XSModelGroup modelGroup = term.asModelGroup();
            if (modelGroup != null) {
                return (modelGroup.getCompositor() == XSModelGroup.Compositor.CHOICE);
            }
        }
    }

    return false;
}
 
Example #2
Source File: ChoiceContentComplexTypeBuilder.java    From TencentKona-8 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 #3
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 #4
Source File: ChoiceContentComplexTypeBuilder.java    From openjdk-8 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 #5
Source File: RefererFinder.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void modelGroup(XSModelGroup group) {
    if(!visited.add(group))  return;

    for (XSParticle p : group.getChildren()) {
        particle(p);
    }
}
 
Example #6
Source File: RefererFinder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void modelGroup(XSModelGroup group) {
    if(!visited.add(group))  return;

    for (XSParticle p : group.getChildren()) {
        particle(p);
    }
}
 
Example #7
Source File: AbstractAxisImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Iterator<T> modelGroup(XSModelGroup group) {
    // compensate for particles that are ignored in SCD
    return new Iterators.Map<T,XSParticle>(group.iterator()) {
        protected Iterator<? extends T> apply(XSParticle p) {
            return particle(p);
        }
    };
}
 
Example #8
Source File: RefererFinder.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void modelGroup(XSModelGroup group) {
    if(!visited.add(group))  return;

    for (XSParticle p : group.getChildren()) {
        particle(p);
    }
}
 
Example #9
Source File: BISchemaBinding.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms the default name produced from XML name
 * by following the customization.
 *
 * This shouldn't be applied to a class name specified
 * by a customization.
 *
 * @param cmp
 *      The schema component from which the default name is derived.
 */
public String mangleClassName( String name, XSComponent cmp ) {
    if( cmp instanceof XSType )
        return nameXmlTransform.typeName.mangle(name);
    if( cmp instanceof XSElementDecl )
        return nameXmlTransform.elementName.mangle(name);
    if( cmp instanceof XSAttributeDecl )
        return nameXmlTransform.attributeName.mangle(name);
    if( cmp instanceof XSModelGroup || cmp instanceof XSModelGroupDecl )
        return nameXmlTransform.modelGroupName.mangle(name);

    // otherwise no modification
    return name;
}
 
Example #10
Source File: DefaultParticleBinder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void modelGroup( XSModelGroup mg ) {
    boolean oldIOP = insideOptionalParticle;
    insideOptionalParticle |= mg.getCompositor()==XSModelGroup.CHOICE;

    for( XSParticle p : mg.getChildren())
        particle(p);

    insideOptionalParticle = oldIOP;
}
 
Example #11
Source File: DefaultParticleBinder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void modelGroup( XSModelGroup mg ) {
    boolean oldIOP = insideOptionalParticle;
    insideOptionalParticle |= mg.getCompositor()==XSModelGroup.CHOICE;

    for( XSParticle p : mg.getChildren())
        particle(p);

    insideOptionalParticle = oldIOP;
}
 
Example #12
Source File: SchemaWriter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void modelGroup( XSModelGroup group, String extraAtts ) {
    println(MessageFormat.format("<{0}{1}>", group.getCompositor(), extraAtts));
    indent++;

    final int len = group.getSize();
    for( int i=0; i<len; i++ )
        particle(group.getChild(i));

    indent--;
    println(MessageFormat.format("</{0}>", group.getCompositor()));
}
 
Example #13
Source File: Axis.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void visit(XSModelGroup mg, List<XSComponent> r) {
    // since model groups never form a cycle, no cycle check is needed
    r.add(mg);
    for (XSParticle p : mg) {
        XSModelGroup child = p.getTerm().asModelGroup();
        if(child!=null)
            visit(child,r);
    }
}
 
Example #14
Source File: Axis.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void visit(XSModelGroup mg, List<XSComponent> r) {
    // since model groups never form a cycle, no cycle check is needed
    r.add(mg);
    for (XSParticle p : mg) {
        XSModelGroup child = p.getTerm().asModelGroup();
        if(child!=null)
            visit(child,r);
    }
}
 
Example #15
Source File: AbstractAxisImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public Iterator<T> modelGroup(XSModelGroup group) {
    // compensate for particles that are ignored in SCD
    return new Iterators.Map<T,XSParticle>(group.iterator()) {
        protected Iterator<? extends T> apply(XSParticle p) {
            return particle(p);
        }
    };
}
 
Example #16
Source File: Axis.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private Iterator<XSModelGroup> filter(XSModelGroup mg) {
    if(mg==null)
        return empty();
    if(mg.getCompositor() == compositor || compositor == null)
        return singleton(mg);
    else
        return empty();
}
 
Example #17
Source File: SchemaTreeTraverser.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates node for model group with additional attributes.
 *
 * @param group     Model group.
 * @param extraAtts Additional attributes.
 */
private void modelGroup(XSModelGroup group, String extraAtts) {
    SchemaTreeNode newNode = new SchemaTreeNode(MessageFormat.format(
            "{0}{1}", new Object[]{group.getCompositor(), extraAtts}),
            group.getLocator());
    this.currNode.add(newNode);
    this.currNode = newNode;

    final int len = group.getSize();
    for (int i = 0; i < len; i++) {
        particle(group.getChild(i));
    }

    this.currNode = (SchemaTreeNode) this.currNode.getParent();
}
 
Example #18
Source File: SchemaTreeTraverser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates node for model group with additional attributes.
 *
 * @param group     Model group.
 * @param extraAtts Additional attributes.
 */
private void modelGroup(XSModelGroup group, String extraAtts) {
    SchemaTreeNode newNode = new SchemaTreeNode(MessageFormat.format(
            "{0}{1}", new Object[]{group.getCompositor(), extraAtts}),
            group.getLocator());
    this.currNode.add(newNode);
    this.currNode = newNode;

    final int len = group.getSize();
    for (int i = 0; i < len; i++) {
        particle(group.getChild(i));
    }

    this.currNode = (SchemaTreeNode) this.currNode.getParent();
}
 
Example #19
Source File: Axis.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Iterate all descendant model groups of the given model group, including itself.
 */
private Iterator<XSComponent> descendants(XSModelGroup mg) {
    // TODO: write a tree iterator
    // for now, we do it eagerly because I'm lazy
    List<XSComponent> r = new ArrayList<XSComponent>();
    visit(mg,r);
    return r.iterator();
}
 
Example #20
Source File: BISchemaBinding.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms the default name produced from XML name
 * by following the customization.
 *
 * This shouldn't be applied to a class name specified
 * by a customization.
 *
 * @param cmp
 *      The schema component from which the default name is derived.
 */
public String mangleClassName( String name, XSComponent cmp ) {
    if( cmp instanceof XSType )
        return nameXmlTransform.typeName.mangle(name);
    if( cmp instanceof XSElementDecl )
        return nameXmlTransform.elementName.mangle(name);
    if( cmp instanceof XSAttributeDecl )
        return nameXmlTransform.attributeName.mangle(name);
    if( cmp instanceof XSModelGroup || cmp instanceof XSModelGroupDecl )
        return nameXmlTransform.modelGroupName.mangle(name);

    // otherwise no modification
    return name;
}
 
Example #21
Source File: AbstractAxisImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public Iterator<T> modelGroup(XSModelGroup group) {
    // compensate for particles that are ignored in SCD
    return new Iterators.Map<T,XSParticle>(group.iterator()) {
        protected Iterator<? extends T> apply(XSParticle p) {
            return particle(p);
        }
    };
}
 
Example #22
Source File: RefererFinder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void modelGroup(XSModelGroup group) {
    if(!visited.add(group))  return;

    for (XSParticle p : group.getChildren()) {
        particle(p);
    }
}
 
Example #23
Source File: Axis.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private Iterator<XSModelGroup> filter(XSModelGroup mg) {
    if(mg==null)
        return empty();
    if(mg.getCompositor() == compositor || compositor == null)
        return singleton(mg);
    else
        return empty();
}
 
Example #24
Source File: SchemaWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void modelGroup( XSModelGroup group, String extraAtts ) {
    println(MessageFormat.format("<{0}{1}>", group.getCompositor(), extraAtts));
    indent++;

    final int len = group.getSize();
    for( int i=0; i<len; i++ )
        particle(group.getChild(i));

    indent--;
    println(MessageFormat.format("</{0}>", group.getCompositor()));
}
 
Example #25
Source File: Axis.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Iterate all descendant model groups of the given model group, including itself.
 */
private Iterator<XSComponent> descendants(XSModelGroup mg) {
    // TODO: write a tree iterator
    // for now, we do it eagerly because I'm lazy
    List<XSComponent> r = new ArrayList<XSComponent>();
    visit(mg,r);
    return r.iterator();
}
 
Example #26
Source File: Axis.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Iterate all descendant model groups of the given model group, including itself.
 */
private Iterator<XSComponent> descendants(XSModelGroup mg) {
    // TODO: write a tree iterator
    // for now, we do it eagerly because I'm lazy
    List<XSComponent> r = new ArrayList<XSComponent>();
    visit(mg,r);
    return r.iterator();
}
 
Example #27
Source File: AbstractAxisImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public Iterator<T> modelGroup(XSModelGroup group) {
    // compensate for particles that are ignored in SCD
    return new Iterators.Map<T,XSParticle>(group.iterator()) {
        protected Iterator<? extends T> apply(XSParticle p) {
            return particle(p);
        }
    };
}
 
Example #28
Source File: SchemaWriter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void modelGroup( XSModelGroup group, String extraAtts ) {
    println(MessageFormat.format("<{0}{1}>", group.getCompositor(), extraAtts));
    indent++;

    final int len = group.getSize();
    for( int i=0; i<len; i++ )
        particle(group.getChild(i));

    indent--;
    println(MessageFormat.format("</{0}>", group.getCompositor()));
}
 
Example #29
Source File: BISchemaBinding.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms the default name produced from XML name
 * by following the customization.
 *
 * This shouldn't be applied to a class name specified
 * by a customization.
 *
 * @param cmp
 *      The schema component from which the default name is derived.
 */
public String mangleClassName( String name, XSComponent cmp ) {
    if( cmp instanceof XSType )
        return nameXmlTransform.typeName.mangle(name);
    if( cmp instanceof XSElementDecl )
        return nameXmlTransform.elementName.mangle(name);
    if( cmp instanceof XSAttributeDecl )
        return nameXmlTransform.attributeName.mangle(name);
    if( cmp instanceof XSModelGroup || cmp instanceof XSModelGroupDecl )
        return nameXmlTransform.modelGroupName.mangle(name);

    // otherwise no modification
    return name;
}
 
Example #30
Source File: ChoiceContentComplexTypeBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private XSModelGroup getTopLevelModelGroup(XSParticle p) {
    XSModelGroup mg = p.getTerm().asModelGroup();
    if( p.getTerm().isModelGroupDecl() )
        mg = p.getTerm().asModelGroupDecl().getModelGroup();
    return mg;
}