Java Code Examples for com.sun.xml.internal.xsom.XSElementDecl#isGlobal()

The following examples show how to use com.sun.xml.internal.xsom.XSElementDecl#isGlobal() . 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: DefaultClassBinder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * If only one global {@link XSElementDecl} is refering to {@link XSType},
 * return that element, otherwise null.
 */
private @Nullable XSElementDecl getSoleElementReferer(@NotNull XSType t) {
    Set<XSComponent> referer = builder.getReferer(t);

    XSElementDecl sole = null;
    for (XSComponent r : referer) {
        if(r instanceof XSElementDecl) {
            XSElementDecl x = (XSElementDecl) r;
            if(!x.isGlobal())
                // local element references can be ignored, as their names are either given
                // by the property, or by the JAXBElement (for things like mixed contents)
                continue;
            if(sole==null)  sole=x;
            else            return null;    // more than one
        } else {
            // if another type refers to this type, that means
            // this type has a sub-type, so type substitution is possible now.
            return null;
        }
    }

    return sole;
}
 
Example 2
Source File: DefaultClassBinder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * If only one global {@link XSElementDecl} is refering to {@link XSType},
 * return that element, otherwise null.
 */
private @Nullable XSElementDecl getSoleElementReferer(@NotNull XSType t) {
    Set<XSComponent> referer = builder.getReferer(t);

    XSElementDecl sole = null;
    for (XSComponent r : referer) {
        if(r instanceof XSElementDecl) {
            XSElementDecl x = (XSElementDecl) r;
            if(!x.isGlobal())
                // local element references can be ignored, as their names are either given
                // by the property, or by the JAXBElement (for things like mixed contents)
                continue;
            if(sole==null)  sole=x;
            else            return null;    // more than one
        } else {
            // if another type refers to this type, that means
            // this type has a sub-type, so type substitution is possible now.
            return null;
        }
    }

    return sole;
}
 
Example 3
Source File: BIProperty.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private CCustomizations getCustomizations( XSParticle src ) {
    // customizations for a particle  should include those defined in the term unless it's global
    // this is so that the schema like:
    //
    // <xs:sequence>
    //   <xs:element name="foo" type="xs:int">
    //     <xs:annotation><xs:appinfo>
    //       <hyperjaxb:... />
    //
    // would be picked up
    if(src.getTerm().isElementDecl()) {
        XSElementDecl xed = src.getTerm().asElementDecl();
        if(xed.isGlobal())
            return getCustomizations((XSComponent)src);
    }

    return getCustomizations(src,src.getTerm());
}
 
Example 4
Source File: DefaultClassBinder.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * If only one global {@link XSElementDecl} is refering to {@link XSType},
 * return that element, otherwise null.
 */
private @Nullable XSElementDecl getSoleElementReferer(@NotNull XSType t) {
    Set<XSComponent> referer = builder.getReferer(t);

    XSElementDecl sole = null;
    for (XSComponent r : referer) {
        if(r instanceof XSElementDecl) {
            XSElementDecl x = (XSElementDecl) r;
            if(!x.isGlobal())
                // local element references can be ignored, as their names are either given
                // by the property, or by the JAXBElement (for things like mixed contents)
                continue;
            if(sole==null)  sole=x;
            else            return null;    // more than one
        } else {
            // if another type refers to this type, that means
            // this type has a sub-type, so type substitution is possible now.
            return null;
        }
    }

    return sole;
}
 
Example 5
Source File: BIProperty.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private CCustomizations getCustomizations( XSParticle src ) {
    // customizations for a particle  should include those defined in the term unless it's global
    // this is so that the schema like:
    //
    // <xs:sequence>
    //   <xs:element name="foo" type="xs:int">
    //     <xs:annotation><xs:appinfo>
    //       <hyperjaxb:... />
    //
    // would be picked up
    if(src.getTerm().isElementDecl()) {
        XSElementDecl xed = src.getTerm().asElementDecl();
        if(xed.isGlobal())
            return getCustomizations((XSComponent)src);
    }

    return getCustomizations(src,src.getTerm());
}
 
Example 6
Source File: BIProperty.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private CCustomizations getCustomizations( XSParticle src ) {
    // customizations for a particle  should include those defined in the term unless it's global
    // this is so that the schema like:
    //
    // <xs:sequence>
    //   <xs:element name="foo" type="xs:int">
    //     <xs:annotation><xs:appinfo>
    //       <hyperjaxb:... />
    //
    // would be picked up
    if(src.getTerm().isElementDecl()) {
        XSElementDecl xed = src.getTerm().asElementDecl();
        if(xed.isGlobal())
            return getCustomizations((XSComponent)src);
    }

    return getCustomizations(src,src.getTerm());
}
 
Example 7
Source File: BIProperty.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private CCustomizations getCustomizations( XSParticle src ) {
    // customizations for a particle  should include those defined in the term unless it's global
    // this is so that the schema like:
    //
    // <xs:sequence>
    //   <xs:element name="foo" type="xs:int">
    //     <xs:annotation><xs:appinfo>
    //       <hyperjaxb:... />
    //
    // would be picked up
    if(src.getTerm().isElementDecl()) {
        XSElementDecl xed = src.getTerm().asElementDecl();
        if(xed.isGlobal())
            return getCustomizations((XSComponent)src);
    }

    return getCustomizations(src,src.getTerm());
}
 
Example 8
Source File: BIProperty.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private CCustomizations getCustomizations( XSParticle src ) {
    // customizations for a particle  should include those defined in the term unless it's global
    // this is so that the schema like:
    //
    // <xs:sequence>
    //   <xs:element name="foo" type="xs:int">
    //     <xs:annotation><xs:appinfo>
    //       <hyperjaxb:... />
    //
    // would be picked up
    if(src.getTerm().isElementDecl()) {
        XSElementDecl xed = src.getTerm().asElementDecl();
        if(xed.isGlobal())
            return getCustomizations((XSComponent)src);
    }

    return getCustomizations(src,src.getTerm());
}
 
Example 9
Source File: DefaultClassBinder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * If only one global {@link XSElementDecl} is refering to {@link XSType},
 * return that element, otherwise null.
 */
private @Nullable XSElementDecl getSoleElementReferer(@NotNull XSType t) {
    Set<XSComponent> referer = builder.getReferer(t);

    XSElementDecl sole = null;
    for (XSComponent r : referer) {
        if(r instanceof XSElementDecl) {
            XSElementDecl x = (XSElementDecl) r;
            if(!x.isGlobal())
                // local element references can be ignored, as their names are either given
                // by the property, or by the JAXBElement (for things like mixed contents)
                continue;
            if(sole==null)  sole=x;
            else            return null;    // more than one
        } else {
            // if another type refers to this type, that means
            // this type has a sub-type, so type substitution is possible now.
            return null;
        }
    }

    return sole;
}
 
Example 10
Source File: BIProperty.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private CCustomizations getCustomizations( XSParticle src ) {
    // customizations for a particle  should include those defined in the term unless it's global
    // this is so that the schema like:
    //
    // <xs:sequence>
    //   <xs:element name="foo" type="xs:int">
    //     <xs:annotation><xs:appinfo>
    //       <hyperjaxb:... />
    //
    // would be picked up
    if(src.getTerm().isElementDecl()) {
        XSElementDecl xed = src.getTerm().asElementDecl();
        if(xed.isGlobal())
            return getCustomizations((XSComponent)src);
    }

    return getCustomizations(src,src.getTerm());
}
 
Example 11
Source File: DefaultClassBinder.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * If only one global {@link XSElementDecl} is refering to {@link XSType},
 * return that element, otherwise null.
 */
private @Nullable XSElementDecl getSoleElementReferer(@NotNull XSType t) {
    Set<XSComponent> referer = builder.getReferer(t);

    XSElementDecl sole = null;
    for (XSComponent r : referer) {
        if(r instanceof XSElementDecl) {
            XSElementDecl x = (XSElementDecl) r;
            if(!x.isGlobal())
                // local element references can be ignored, as their names are either given
                // by the property, or by the JAXBElement (for things like mixed contents)
                continue;
            if(sole==null)  sole=x;
            else            return null;    // more than one
        } else {
            // if another type refers to this type, that means
            // this type has a sub-type, so type substitution is possible now.
            return null;
        }
    }

    return sole;
}
 
Example 12
Source File: BIProperty.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private CCustomizations getCustomizations( XSParticle src ) {
    // customizations for a particle  should include those defined in the term unless it's global
    // this is so that the schema like:
    //
    // <xs:sequence>
    //   <xs:element name="foo" type="xs:int">
    //     <xs:annotation><xs:appinfo>
    //       <hyperjaxb:... />
    //
    // would be picked up
    if(src.getTerm().isElementDecl()) {
        XSElementDecl xed = src.getTerm().asElementDecl();
        if(xed.isGlobal())
            return getCustomizations((XSComponent)src);
    }

    return getCustomizations(src,src.getTerm());
}
 
Example 13
Source File: DefaultClassBinder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * If only one global {@link XSElementDecl} is refering to {@link XSType},
 * return that element, otherwise null.
 */
private @Nullable XSElementDecl getSoleElementReferer(@NotNull XSType t) {
    Set<XSComponent> referer = builder.getReferer(t);

    XSElementDecl sole = null;
    for (XSComponent r : referer) {
        if(r instanceof XSElementDecl) {
            XSElementDecl x = (XSElementDecl) r;
            if(!x.isGlobal())
                // local element references can be ignored, as their names are either given
                // by the property, or by the JAXBElement (for things like mixed contents)
                continue;
            if(sole==null)  sole=x;
            else            return null;    // more than one
        } else {
            // if another type refers to this type, that means
            // this type has a sub-type, so type substitution is possible now.
            return null;
        }
    }

    return sole;
}
 
Example 14
Source File: DefaultClassBinder.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public CElement elementDecl(XSElementDecl decl) {
    CElement r = allow(decl,decl.getName());

    if(r==null) {
        QName tagName = getName(decl);
        CCustomizations custs = builder.getBindInfo(decl).toCustomizationList();

        if(decl.isGlobal()) {
            if(isCollapsable(decl)) {
                // we want the returned type to be built as a complex type,
                // so the binding cannot be delayed.
                return selector.bindToType(decl.getType().asComplexType(),decl,true);
            } else {
                String className = null;
                if(getGlobalBinding().isGenerateElementClass())
                    className = deriveName(decl);

                // otherwise map global elements to JAXBElement
                CElementInfo cei = new CElementInfo(
                    model, tagName, selector.getClassScope(), className, custs, decl.getLocator());
                selector.boundElements.put(decl,cei);

                stb.refererStack.push(decl);    // referer is element
                cei.initContentType( selector.bindToType(decl.getType(),decl), decl, decl.getDefaultValue() );
                stb.refererStack.pop();
                r = cei;
            }
        }
    }

    // have the substitution member derive from the substitution head
    XSElementDecl top = decl.getSubstAffiliation();
    if(top!=null) {
        CElement topci = selector.bindToType(top,decl);

        if(r instanceof CClassInfo && topci instanceof CClassInfo)
            ((CClassInfo)r).setBaseClass((CClassInfo)topci);
        if (r instanceof CElementInfo && topci instanceof CElementInfo)
            ((CElementInfo)r).setSubstitutionHead((CElementInfo)topci);
    }

    return r;
}
 
Example 15
Source File: DefaultClassBinder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public CElement elementDecl(XSElementDecl decl) {
    CElement r = allow(decl,decl.getName());

    if(r==null) {
        QName tagName = getName(decl);
        CCustomizations custs = builder.getBindInfo(decl).toCustomizationList();

        if(decl.isGlobal()) {
            if(isCollapsable(decl)) {
                // we want the returned type to be built as a complex type,
                // so the binding cannot be delayed.
                return selector.bindToType(decl.getType().asComplexType(),decl,true);
            } else {
                String className = null;
                if(getGlobalBinding().isGenerateElementClass())
                    className = deriveName(decl);

                // otherwise map global elements to JAXBElement
                CElementInfo cei = new CElementInfo(
                    model, tagName, selector.getClassScope(), className, custs, decl.getLocator());
                selector.boundElements.put(decl,cei);

                stb.refererStack.push(decl);    // referer is element
                cei.initContentType( selector.bindToType(decl.getType(),decl), decl, decl.getDefaultValue() );
                stb.refererStack.pop();
                r = cei;
            }
        }
    }

    // have the substitution member derive from the substitution head
    XSElementDecl top = decl.getSubstAffiliation();
    if(top!=null) {
        CElement topci = selector.bindToType(top,decl);

        if(r instanceof CClassInfo && topci instanceof CClassInfo)
            ((CClassInfo)r).setBaseClass((CClassInfo)topci);
        if (r instanceof CElementInfo && topci instanceof CElementInfo)
            ((CElementInfo)r).setSubstitutionHead((CElementInfo)topci);
    }

    return r;
}
 
Example 16
Source File: DefaultClassBinder.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public CElement elementDecl(XSElementDecl decl) {
    CElement r = allow(decl,decl.getName());

    if(r==null) {
        QName tagName = getName(decl);
        CCustomizations custs = builder.getBindInfo(decl).toCustomizationList();

        if(decl.isGlobal()) {
            if(isCollapsable(decl)) {
                // we want the returned type to be built as a complex type,
                // so the binding cannot be delayed.
                return selector.bindToType(decl.getType().asComplexType(),decl,true);
            } else {
                String className = null;
                if(getGlobalBinding().isGenerateElementClass())
                    className = deriveName(decl);

                // otherwise map global elements to JAXBElement
                CElementInfo cei = new CElementInfo(
                    model, tagName, selector.getClassScope(), className, custs, decl.getLocator());
                selector.boundElements.put(decl,cei);

                stb.refererStack.push(decl);    // referer is element
                cei.initContentType( selector.bindToType(decl.getType(),decl), decl, decl.getDefaultValue() );
                stb.refererStack.pop();
                r = cei;
            }
        }
    }

    // have the substitution member derive from the substitution head
    XSElementDecl top = decl.getSubstAffiliation();
    if(top!=null) {
        CElement topci = selector.bindToType(top,decl);

        if(r instanceof CClassInfo && topci instanceof CClassInfo)
            ((CClassInfo)r).setBaseClass((CClassInfo)topci);
        if (r instanceof CElementInfo && topci instanceof CElementInfo)
            ((CElementInfo)r).setSubstitutionHead((CElementInfo)topci);
    }

    return r;
}
 
Example 17
Source File: DefaultClassBinder.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public CElement elementDecl(XSElementDecl decl) {
    CElement r = allow(decl,decl.getName());

    if(r==null) {
        QName tagName = getName(decl);
        CCustomizations custs = builder.getBindInfo(decl).toCustomizationList();

        if(decl.isGlobal()) {
            if(isCollapsable(decl)) {
                // we want the returned type to be built as a complex type,
                // so the binding cannot be delayed.
                return selector.bindToType(decl.getType().asComplexType(),decl,true);
            } else {
                String className = null;
                if(getGlobalBinding().isGenerateElementClass())
                    className = deriveName(decl);

                // otherwise map global elements to JAXBElement
                CElementInfo cei = new CElementInfo(
                    model, tagName, selector.getClassScope(), className, custs, decl.getLocator());
                selector.boundElements.put(decl,cei);

                stb.refererStack.push(decl);    // referer is element
                cei.initContentType( selector.bindToType(decl.getType(),decl), decl, decl.getDefaultValue() );
                stb.refererStack.pop();
                r = cei;
            }
        }
    }

    // have the substitution member derive from the substitution head
    XSElementDecl top = decl.getSubstAffiliation();
    if(top!=null) {
        CElement topci = selector.bindToType(top,decl);

        if(r instanceof CClassInfo && topci instanceof CClassInfo)
            ((CClassInfo)r).setBaseClass((CClassInfo)topci);
        if (r instanceof CElementInfo && topci instanceof CElementInfo)
            ((CElementInfo)r).setSubstitutionHead((CElementInfo)topci);
    }

    return r;
}
 
Example 18
Source File: DefaultClassBinder.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public CElement elementDecl(XSElementDecl decl) {
    CElement r = allow(decl,decl.getName());

    if(r==null) {
        QName tagName = getName(decl);
        CCustomizations custs = builder.getBindInfo(decl).toCustomizationList();

        if(decl.isGlobal()) {
            if(isCollapsable(decl)) {
                // we want the returned type to be built as a complex type,
                // so the binding cannot be delayed.
                return selector.bindToType(decl.getType().asComplexType(),decl,true);
            } else {
                String className = null;
                if(getGlobalBinding().isGenerateElementClass())
                    className = deriveName(decl);

                // otherwise map global elements to JAXBElement
                CElementInfo cei = new CElementInfo(
                    model, tagName, selector.getClassScope(), className, custs, decl.getLocator());
                selector.boundElements.put(decl,cei);

                stb.refererStack.push(decl);    // referer is element
                cei.initContentType( selector.bindToType(decl.getType(),decl), decl, decl.getDefaultValue() );
                stb.refererStack.pop();
                r = cei;
            }
        }
    }

    // have the substitution member derive from the substitution head
    XSElementDecl top = decl.getSubstAffiliation();
    if(top!=null) {
        CElement topci = selector.bindToType(top,decl);

        if(r instanceof CClassInfo && topci instanceof CClassInfo)
            ((CClassInfo)r).setBaseClass((CClassInfo)topci);
        if (r instanceof CElementInfo && topci instanceof CElementInfo)
            ((CElementInfo)r).setSubstitutionHead((CElementInfo)topci);
    }

    return r;
}
 
Example 19
Source File: DefaultClassBinder.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public CElement elementDecl(XSElementDecl decl) {
    CElement r = allow(decl,decl.getName());

    if(r==null) {
        QName tagName = getName(decl);
        CCustomizations custs = builder.getBindInfo(decl).toCustomizationList();

        if(decl.isGlobal()) {
            if(isCollapsable(decl)) {
                // we want the returned type to be built as a complex type,
                // so the binding cannot be delayed.
                return selector.bindToType(decl.getType().asComplexType(),decl,true);
            } else {
                String className = null;
                if(getGlobalBinding().isGenerateElementClass())
                    className = deriveName(decl);

                // otherwise map global elements to JAXBElement
                CElementInfo cei = new CElementInfo(
                    model, tagName, selector.getClassScope(), className, custs, decl.getLocator());
                selector.boundElements.put(decl,cei);

                stb.refererStack.push(decl);    // referer is element
                cei.initContentType( selector.bindToType(decl.getType(),decl), decl, decl.getDefaultValue() );
                stb.refererStack.pop();
                r = cei;
            }
        }
    }

    // have the substitution member derive from the substitution head
    XSElementDecl top = decl.getSubstAffiliation();
    if(top!=null) {
        CElement topci = selector.bindToType(top,decl);

        if(r instanceof CClassInfo && topci instanceof CClassInfo)
            ((CClassInfo)r).setBaseClass((CClassInfo)topci);
        if (r instanceof CElementInfo && topci instanceof CElementInfo)
            ((CElementInfo)r).setSubstitutionHead((CElementInfo)topci);
    }

    return r;
}
 
Example 20
Source File: DefaultClassBinder.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public CElement elementDecl(XSElementDecl decl) {
    CElement r = allow(decl,decl.getName());

    if(r==null) {
        QName tagName = getName(decl);
        CCustomizations custs = builder.getBindInfo(decl).toCustomizationList();

        if(decl.isGlobal()) {
            if(isCollapsable(decl)) {
                // we want the returned type to be built as a complex type,
                // so the binding cannot be delayed.
                return selector.bindToType(decl.getType().asComplexType(),decl,true);
            } else {
                String className = null;
                if(getGlobalBinding().isGenerateElementClass())
                    className = deriveName(decl);

                // otherwise map global elements to JAXBElement
                CElementInfo cei = new CElementInfo(
                    model, tagName, selector.getClassScope(), className, custs, decl.getLocator());
                selector.boundElements.put(decl,cei);

                stb.refererStack.push(decl);    // referer is element
                cei.initContentType( selector.bindToType(decl.getType(),decl), decl, decl.getDefaultValue() );
                stb.refererStack.pop();
                r = cei;
            }
        }
    }

    // have the substitution member derive from the substitution head
    XSElementDecl top = decl.getSubstAffiliation();
    if(top!=null) {
        CElement topci = selector.bindToType(top,decl);

        if(r instanceof CClassInfo && topci instanceof CClassInfo)
            ((CClassInfo)r).setBaseClass((CClassInfo)topci);
        if (r instanceof CElementInfo && topci instanceof CElementInfo)
            ((CElementInfo)r).setSubstitutionHead((CElementInfo)topci);
    }

    return r;
}