Java Code Examples for com.sun.xml.internal.xsom.XSParticle#getTerm()

The following examples show how to use com.sun.xml.internal.xsom.XSParticle#getTerm() . 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 TencentKona-8 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: 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 3
Source File: BGMBuilder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Gets the {@link BIDom} object that applies to the given particle.
 */
protected final BIDom getLocalDomCustomization( XSParticle p ) {
    if (p == null) {
        return null;
    }
    BIDom dom = getBindInfo(p).get(BIDom.class);
    if(dom!=null)  return dom;

    // if not, the term might have one.
    dom = getBindInfo(p.getTerm()).get(BIDom.class);
    if(dom!=null)  return dom;

    XSTerm t = p.getTerm();
    // type could also have one, in case of the dom customization
    if(t.isElementDecl())
        return getBindInfo(t.asElementDecl().getType()).get(BIDom.class);
    // similarly the model group in a model group definition may have one.
    if(t.isModelGroupDecl())
        return getBindInfo(t.asModelGroupDecl().getModelGroup()).get(BIDom.class);

    return null;
}
 
Example 4
Source File: AbstractMappingImpl.java    From openjdk-8 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 5
Source File: BGMBuilder.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Gets the {@link BIDom} object that applies to the given particle.
 */
protected final BIDom getLocalDomCustomization( XSParticle p ) {
    if (p == null) {
        return null;
    }
    BIDom dom = getBindInfo(p).get(BIDom.class);
    if(dom!=null)  return dom;

    // if not, the term might have one.
    dom = getBindInfo(p.getTerm()).get(BIDom.class);
    if(dom!=null)  return dom;

    XSTerm t = p.getTerm();
    // type could also have one, in case of the dom customization
    if(t.isElementDecl())
        return getBindInfo(t.asElementDecl().getType()).get(BIDom.class);
    // similarly the model group in a model group definition may have one.
    if(t.isModelGroupDecl())
        return getBindInfo(t.asModelGroupDecl().getModelGroup()).get(BIDom.class);

    return null;
}
 
Example 6
Source File: BGMBuilder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Gets the {@link BIDom} object that applies to the given particle.
 */
protected final BIDom getLocalDomCustomization( XSParticle p ) {
    if (p == null) {
        return null;
    }
    BIDom dom = getBindInfo(p).get(BIDom.class);
    if(dom!=null)  return dom;

    // if not, the term might have one.
    dom = getBindInfo(p.getTerm()).get(BIDom.class);
    if(dom!=null)  return dom;

    XSTerm t = p.getTerm();
    // type could also have one, in case of the dom customization
    if(t.isElementDecl())
        return getBindInfo(t.asElementDecl().getType()).get(BIDom.class);
    // similarly the model group in a model group definition may have one.
    if(t.isModelGroupDecl())
        return getBindInfo(t.asModelGroupDecl().getModelGroup()).get(BIDom.class);

    return null;
}
 
Example 7
Source File: AbstractMappingImpl.java    From openjdk-jdk9 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 8
Source File: BGMBuilder.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Gets the {@link BIDom} object that applies to the given particle.
 */
protected final BIDom getLocalDomCustomization( XSParticle p ) {
    if (p == null) {
        return null;
    }
    BIDom dom = getBindInfo(p).get(BIDom.class);
    if(dom!=null)  return dom;

    // if not, the term might have one.
    dom = getBindInfo(p.getTerm()).get(BIDom.class);
    if(dom!=null)  return dom;

    XSTerm t = p.getTerm();
    // type could also have one, in case of the dom customization
    if(t.isElementDecl())
        return getBindInfo(t.asElementDecl().getType()).get(BIDom.class);
    // similarly the model group in a model group definition may have one.
    if(t.isModelGroupDecl())
        return getBindInfo(t.asModelGroupDecl().getModelGroup()).get(BIDom.class);

    return null;
}
 
Example 9
Source File: BGMBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Gets the {@link BIDom} object that applies to the given particle.
 */
protected final BIDom getLocalDomCustomization( XSParticle p ) {
    if (p == null) {
        return null;
    }
    BIDom dom = getBindInfo(p).get(BIDom.class);
    if(dom!=null)  return dom;

    // if not, the term might have one.
    dom = getBindInfo(p.getTerm()).get(BIDom.class);
    if(dom!=null)  return dom;

    XSTerm t = p.getTerm();
    // type could also have one, in case of the dom customization
    if(t.isElementDecl())
        return getBindInfo(t.asElementDecl().getType()).get(BIDom.class);
    // similarly the model group in a model group definition may have one.
    if(t.isModelGroupDecl())
        return getBindInfo(t.asModelGroupDecl().getModelGroup()).get(BIDom.class);

    return null;
}
 
Example 10
Source File: DefaultParticleBinder.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void particle( XSParticle p ) {

            if(getLocalPropCustomization(p)!=null
            || builder.getLocalDomCustomization(p)!=null) {
                // if a property customization is specfied,
                // check that value and turn around.
                check(p);
                mark(p);
                return;
            }

            XSTerm t = p.getTerm();

            if(p.isRepeated() && (t.isModelGroup() || t.isModelGroupDecl())) {
                // a repeated model group gets its own property
                mark(p);
                return;
            }

            if(forcedProps.contains(p)) {
                // this particle must become a property
                mark(p);
                return;
            }

            outerParticle = p;
            t.visit(this);
        }
 
Example 11
Source File: DefaultParticleBinder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void particle( XSParticle p ) {

            if(getLocalPropCustomization(p)!=null
            || builder.getLocalDomCustomization(p)!=null) {
                // if a property customization is specfied,
                // check that value and turn around.
                check(p);
                mark(p);
                return;
            }

            XSTerm t = p.getTerm();

            if(p.isRepeated() && (t.isModelGroup() || t.isModelGroupDecl())) {
                // a repeated model group gets its own property
                mark(p);
                return;
            }

            if(forcedProps.contains(p)) {
                // this particle must become a property
                mark(p);
                return;
            }

            outerParticle = p;
            t.visit(this);
        }
 
Example 12
Source File: DefaultParticleBinder.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void particle( XSParticle p ) {

            if(getLocalPropCustomization(p)!=null
            || builder.getLocalDomCustomization(p)!=null) {
                // if a property customization is specfied,
                // check that value and turn around.
                check(p);
                mark(p);
                return;
            }

            XSTerm t = p.getTerm();

            if(p.isRepeated() && (t.isModelGroup() || t.isModelGroupDecl())) {
                // a repeated model group gets its own property
                mark(p);
                return;
            }

            if(forcedProps.contains(p)) {
                // this particle must become a property
                mark(p);
                return;
            }

            outerParticle = p;
            t.visit(this);
        }
 
Example 13
Source File: DefaultParticleBinder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void particle( XSParticle p ) {

            if(getLocalPropCustomization(p)!=null
            || builder.getLocalDomCustomization(p)!=null) {
                // if a property customization is specfied,
                // check that value and turn around.
                check(p);
                mark(p);
                return;
            }

            XSTerm t = p.getTerm();

            if(p.isRepeated() && (t.isModelGroup() || t.isModelGroupDecl())) {
                // a repeated model group gets its own property
                mark(p);
                return;
            }

            if(forcedProps.contains(p)) {
                // this particle must become a property
                mark(p);
                return;
            }

            outerParticle = p;
            t.visit(this);
        }
 
Example 14
Source File: DefaultParticleBinder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void particle( XSParticle p ) {

            if(getLocalPropCustomization(p)!=null
            || builder.getLocalDomCustomization(p)!=null) {
                // if a property customization is specfied,
                // check that value and turn around.
                check(p);
                mark(p);
                return;
            }

            XSTerm t = p.getTerm();

            if(p.isRepeated() && (t.isModelGroup() || t.isModelGroupDecl())) {
                // a repeated model group gets its own property
                mark(p);
                return;
            }

            if(forcedProps.contains(p)) {
                // this particle must become a property
                mark(p);
                return;
            }

            outerParticle = p;
            t.visit(this);
        }
 
Example 15
Source File: ParticleBinder.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
     * Computes the label of a given particle.
     * Usually, the getLabel method should be used instead.
     */
    protected final String computeLabel( XSParticle p ) {
        // if the particle carries a customization, use that value.
        // since we are binding content models, it's always non-constant properties.
        BIProperty cust = getLocalPropCustomization(p);
        if(cust!=null && cust.getPropertyName(false)!=null)
            return cust.getPropertyName(false);

        // no explicit property name is given. Compute one.

        XSTerm t = p.getTerm();

//        // first, check if a term is going to be a class, if so, use that name.
//        ClassItem ci = owner.selector.select(t);
//        if(ci!=null) {
//            return makeJavaName(ci.getTypeAsDefined().name());
//        }

        // if it fails, compute the default name according to the spec.
        if(t.isElementDecl())
            // for element, take the element name.
            return makeJavaName(p,t.asElementDecl().getName());
        if(t.isModelGroupDecl())
            // for named model groups, take that name
            return makeJavaName(p,t.asModelGroupDecl().getName());
        if(t.isWildcard())
            // the spec says it will map to "any" by default.
            return makeJavaName(p,"Any");
        if(t.isModelGroup()) {
            try {
                return getSpecDefaultName(t.asModelGroup(),p.isRepeated());
            } catch( ParseException e ) {
                // unable to generate a name.
                getErrorReporter().error(t.getLocator(),
                    Messages.ERR_UNABLE_TO_GENERATE_NAME_FROM_MODELGROUP);
                return "undefined"; // recover from error by assuming something
            }
        }

        // there are only four types of XSTerm.
        throw new AssertionError();
    }
 
Example 16
Source File: ParticleBinder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
     * Computes the label of a given particle.
     * Usually, the getLabel method should be used instead.
     */
    protected final String computeLabel( XSParticle p ) {
        // if the particle carries a customization, use that value.
        // since we are binding content models, it's always non-constant properties.
        BIProperty cust = getLocalPropCustomization(p);
        if(cust!=null && cust.getPropertyName(false)!=null)
            return cust.getPropertyName(false);

        // no explicit property name is given. Compute one.

        XSTerm t = p.getTerm();

//        // first, check if a term is going to be a class, if so, use that name.
//        ClassItem ci = owner.selector.select(t);
//        if(ci!=null) {
//            return makeJavaName(ci.getTypeAsDefined().name());
//        }

        // if it fails, compute the default name according to the spec.
        if(t.isElementDecl())
            // for element, take the element name.
            return makeJavaName(p,t.asElementDecl().getName());
        if(t.isModelGroupDecl())
            // for named model groups, take that name
            return makeJavaName(p,t.asModelGroupDecl().getName());
        if(t.isWildcard())
            // the spec says it will map to "any" by default.
            return makeJavaName(p,"Any");
        if(t.isModelGroup()) {
            try {
                return getSpecDefaultName(t.asModelGroup(),p.isRepeated());
            } catch( ParseException e ) {
                // unable to generate a name.
                getErrorReporter().error(t.getLocator(),
                    Messages.ERR_UNABLE_TO_GENERATE_NAME_FROM_MODELGROUP);
                return "undefined"; // recover from error by assuming something
            }
        }

        // there are only four types of XSTerm.
        throw new AssertionError();
    }
 
Example 17
Source File: ParticleBinder.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
     * Computes the label of a given particle.
     * Usually, the getLabel method should be used instead.
     */
    protected final String computeLabel( XSParticle p ) {
        // if the particle carries a customization, use that value.
        // since we are binding content models, it's always non-constant properties.
        BIProperty cust = getLocalPropCustomization(p);
        if(cust!=null && cust.getPropertyName(false)!=null)
            return cust.getPropertyName(false);

        // no explicit property name is given. Compute one.

        XSTerm t = p.getTerm();

//        // first, check if a term is going to be a class, if so, use that name.
//        ClassItem ci = owner.selector.select(t);
//        if(ci!=null) {
//            return makeJavaName(ci.getTypeAsDefined().name());
//        }

        // if it fails, compute the default name according to the spec.
        if(t.isElementDecl())
            // for element, take the element name.
            return makeJavaName(p,t.asElementDecl().getName());
        if(t.isModelGroupDecl())
            // for named model groups, take that name
            return makeJavaName(p,t.asModelGroupDecl().getName());
        if(t.isWildcard())
            // the spec says it will map to "any" by default.
            return makeJavaName(p,"Any");
        if(t.isModelGroup()) {
            try {
                return getSpecDefaultName(t.asModelGroup(),p.isRepeated());
            } catch( ParseException e ) {
                // unable to generate a name.
                getErrorReporter().error(t.getLocator(),
                    Messages.ERR_UNABLE_TO_GENERATE_NAME_FROM_MODELGROUP);
                return "undefined"; // recover from error by assuming something
            }
        }

        // there are only four types of XSTerm.
        throw new AssertionError();
    }
 
Example 18
Source File: ParticleBinder.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
     * Computes the label of a given particle.
     * Usually, the getLabel method should be used instead.
     */
    protected final String computeLabel( XSParticle p ) {
        // if the particle carries a customization, use that value.
        // since we are binding content models, it's always non-constant properties.
        BIProperty cust = getLocalPropCustomization(p);
        if(cust!=null && cust.getPropertyName(false)!=null)
            return cust.getPropertyName(false);

        // no explicit property name is given. Compute one.

        XSTerm t = p.getTerm();

//        // first, check if a term is going to be a class, if so, use that name.
//        ClassItem ci = owner.selector.select(t);
//        if(ci!=null) {
//            return makeJavaName(ci.getTypeAsDefined().name());
//        }

        // if it fails, compute the default name according to the spec.
        if(t.isElementDecl())
            // for element, take the element name.
            return makeJavaName(p,t.asElementDecl().getName());
        if(t.isModelGroupDecl())
            // for named model groups, take that name
            return makeJavaName(p,t.asModelGroupDecl().getName());
        if(t.isWildcard())
            // the spec says it will map to "any" by default.
            return makeJavaName(p,"Any");
        if(t.isModelGroup()) {
            try {
                return getSpecDefaultName(t.asModelGroup(),p.isRepeated());
            } catch( ParseException e ) {
                // unable to generate a name.
                getErrorReporter().error(t.getLocator(),
                    Messages.ERR_UNABLE_TO_GENERATE_NAME_FROM_MODELGROUP);
                return "undefined"; // recover from error by assuming something
            }
        }

        // there are only four types of XSTerm.
        throw new AssertionError();
    }
 
Example 19
Source File: ParticleBinder.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
     * Computes the label of a given particle.
     * Usually, the getLabel method should be used instead.
     */
    protected final String computeLabel( XSParticle p ) {
        // if the particle carries a customization, use that value.
        // since we are binding content models, it's always non-constant properties.
        BIProperty cust = getLocalPropCustomization(p);
        if(cust!=null && cust.getPropertyName(false)!=null)
            return cust.getPropertyName(false);

        // no explicit property name is given. Compute one.

        XSTerm t = p.getTerm();

//        // first, check if a term is going to be a class, if so, use that name.
//        ClassItem ci = owner.selector.select(t);
//        if(ci!=null) {
//            return makeJavaName(ci.getTypeAsDefined().name());
//        }

        // if it fails, compute the default name according to the spec.
        if(t.isElementDecl())
            // for element, take the element name.
            return makeJavaName(p,t.asElementDecl().getName());
        if(t.isModelGroupDecl())
            // for named model groups, take that name
            return makeJavaName(p,t.asModelGroupDecl().getName());
        if(t.isWildcard())
            // the spec says it will map to "any" by default.
            return makeJavaName(p,"Any");
        if(t.isModelGroup()) {
            try {
                return getSpecDefaultName(t.asModelGroup(),p.isRepeated());
            } catch( ParseException e ) {
                // unable to generate a name.
                getErrorReporter().error(t.getLocator(),
                    Messages.ERR_UNABLE_TO_GENERATE_NAME_FROM_MODELGROUP);
                return "undefined"; // recover from error by assuming something
            }
        }

        // there are only four types of XSTerm.
        throw new AssertionError();
    }
 
Example 20
Source File: ParticleBinder.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
     * Computes the label of a given particle.
     * Usually, the getLabel method should be used instead.
     */
    protected final String computeLabel( XSParticle p ) {
        // if the particle carries a customization, use that value.
        // since we are binding content models, it's always non-constant properties.
        BIProperty cust = getLocalPropCustomization(p);
        if(cust!=null && cust.getPropertyName(false)!=null)
            return cust.getPropertyName(false);

        // no explicit property name is given. Compute one.

        XSTerm t = p.getTerm();

//        // first, check if a term is going to be a class, if so, use that name.
//        ClassItem ci = owner.selector.select(t);
//        if(ci!=null) {
//            return makeJavaName(ci.getTypeAsDefined().name());
//        }

        // if it fails, compute the default name according to the spec.
        if(t.isElementDecl())
            // for element, take the element name.
            return makeJavaName(p,t.asElementDecl().getName());
        if(t.isModelGroupDecl())
            // for named model groups, take that name
            return makeJavaName(p,t.asModelGroupDecl().getName());
        if(t.isWildcard())
            // the spec says it will map to "any" by default.
            return makeJavaName(p,"Any");
        if(t.isModelGroup()) {
            try {
                return getSpecDefaultName(t.asModelGroup(),p.isRepeated());
            } catch( ParseException e ) {
                // unable to generate a name.
                getErrorReporter().error(t.getLocator(),
                    Messages.ERR_UNABLE_TO_GENERATE_NAME_FROM_MODELGROUP);
                return "undefined"; // recover from error by assuming something
            }
        }

        // there are only four types of XSTerm.
        throw new AssertionError();
    }