com.sun.tools.internal.xjc.generator.annotation.spec.XmlSeeAlsoWriter Java Examples

The following examples show how to use com.sun.tools.internal.xjc.generator.annotation.spec.XmlSeeAlsoWriter. 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: BeanGenerator.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Generates the body of a class.
 *
 */
private void generateClassBody(ClassOutlineImpl cc) {
    CClassInfo target = cc.target;

    // used to simplify the generated annotations
    String mostUsedNamespaceURI = cc._package().getMostUsedNamespaceURI();

    // [RESULT]
    // @XmlType(name="foo", targetNamespace="bar://baz")
    XmlTypeWriter xtw = cc.implClass.annotate2(XmlTypeWriter.class);
    writeTypeName(cc.target.getTypeName(), xtw, mostUsedNamespaceURI);

    if (model.options.target.isLaterThan(SpecVersion.V2_1)) {
        // @XmlSeeAlso
        Iterator<CClassInfo> subclasses = cc.target.listSubclasses();
        if (subclasses.hasNext()) {
            XmlSeeAlsoWriter saw = cc.implClass.annotate2(XmlSeeAlsoWriter.class);
            while (subclasses.hasNext()) {
                CClassInfo s = subclasses.next();
                saw.value(getClazz(s).implRef);
            }
        }
    }

    if (target.isElement()) {
        String namespaceURI = target.getElementName().getNamespaceURI();
        String localPart = target.getElementName().getLocalPart();

        // [RESULT]
        // @XmlRootElement(name="foo", targetNamespace="bar://baz")
        XmlRootElementWriter xrew = cc.implClass.annotate2(XmlRootElementWriter.class);
        xrew.name(localPart);
        if (!namespaceURI.equals(mostUsedNamespaceURI)) // only generate if necessary
        {
            xrew.namespace(namespaceURI);
        }
    }

    if (target.isOrdered()) {
        for (CPropertyInfo p : target.getProperties()) {
            if (!(p instanceof CAttributePropertyInfo)) {
                if (!((p instanceof CReferencePropertyInfo)
                        && ((CReferencePropertyInfo) p).isDummy())) {
                    xtw.propOrder(p.getName(false));
                }
            }
        }
    } else {
        // produce empty array
        xtw.getAnnotationUse().paramArray("propOrder");
    }

    for (CPropertyInfo prop : target.getProperties()) {
        generateFieldDecl(cc, prop);
    }

    if (target.declaresAttributeWildcard()) {
        generateAttributeWildcard(cc);
    }

    // generate some class level javadoc
    cc.ref.javadoc().append(target.javadoc);

    cc._package().objectFactoryGenerator().populate(cc);
}
 
Example #2
Source File: BeanGenerator.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Generates the body of a class.
 *
 */
private void generateClassBody(ClassOutlineImpl cc) {
    CClassInfo target = cc.target;

    // used to simplify the generated annotations
    String mostUsedNamespaceURI = cc._package().getMostUsedNamespaceURI();

    // [RESULT]
    // @XmlType(name="foo", targetNamespace="bar://baz")
    XmlTypeWriter xtw = cc.implClass.annotate2(XmlTypeWriter.class);
    writeTypeName(cc.target.getTypeName(), xtw, mostUsedNamespaceURI);

    if (model.options.target.isLaterThan(SpecVersion.V2_1)) {
        // @XmlSeeAlso
        Iterator<CClassInfo> subclasses = cc.target.listSubclasses();
        if (subclasses.hasNext()) {
            XmlSeeAlsoWriter saw = cc.implClass.annotate2(XmlSeeAlsoWriter.class);
            while (subclasses.hasNext()) {
                CClassInfo s = subclasses.next();
                saw.value(getClazz(s).implRef);
            }
        }
    }

    if (target.isElement()) {
        String namespaceURI = target.getElementName().getNamespaceURI();
        String localPart = target.getElementName().getLocalPart();

        // [RESULT]
        // @XmlRootElement(name="foo", targetNamespace="bar://baz")
        XmlRootElementWriter xrew = cc.implClass.annotate2(XmlRootElementWriter.class);
        xrew.name(localPart);
        if (!namespaceURI.equals(mostUsedNamespaceURI)) // only generate if necessary
        {
            xrew.namespace(namespaceURI);
        }
    }

    if (target.isOrdered()) {
        for (CPropertyInfo p : target.getProperties()) {
            if (!(p instanceof CAttributePropertyInfo)) {
                if (!((p instanceof CReferencePropertyInfo)
                        && ((CReferencePropertyInfo) p).isDummy())) {
                    xtw.propOrder(p.getName(false));
                }
            }
        }
    } else {
        // produce empty array
        xtw.getAnnotationUse().paramArray("propOrder");
    }

    for (CPropertyInfo prop : target.getProperties()) {
        generateFieldDecl(cc, prop);
    }

    if (target.declaresAttributeWildcard()) {
        generateAttributeWildcard(cc);
    }

    // generate some class level javadoc
    cc.ref.javadoc().append(target.javadoc);

    cc._package().objectFactoryGenerator().populate(cc);
}
 
Example #3
Source File: BeanGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Generates the body of a class.
 *
 */
private void generateClassBody(ClassOutlineImpl cc) {
    CClassInfo target = cc.target;

    // used to simplify the generated annotations
    String mostUsedNamespaceURI = cc._package().getMostUsedNamespaceURI();

    // [RESULT]
    // @XmlType(name="foo", targetNamespace="bar://baz")
    XmlTypeWriter xtw = cc.implClass.annotate2(XmlTypeWriter.class);
    writeTypeName(cc.target.getTypeName(), xtw, mostUsedNamespaceURI);

    if (model.options.target.isLaterThan(SpecVersion.V2_1)) {
        // @XmlSeeAlso
        Iterator<CClassInfo> subclasses = cc.target.listSubclasses();
        if (subclasses.hasNext()) {
            XmlSeeAlsoWriter saw = cc.implClass.annotate2(XmlSeeAlsoWriter.class);
            while (subclasses.hasNext()) {
                CClassInfo s = subclasses.next();
                saw.value(getClazz(s).implRef);
            }
        }
    }

    if (target.isElement()) {
        String namespaceURI = target.getElementName().getNamespaceURI();
        String localPart = target.getElementName().getLocalPart();

        // [RESULT]
        // @XmlRootElement(name="foo", targetNamespace="bar://baz")
        XmlRootElementWriter xrew = cc.implClass.annotate2(XmlRootElementWriter.class);
        xrew.name(localPart);
        if (!namespaceURI.equals(mostUsedNamespaceURI)) // only generate if necessary
        {
            xrew.namespace(namespaceURI);
        }
    }

    if (target.isOrdered()) {
        for (CPropertyInfo p : target.getProperties()) {
            if (!(p instanceof CAttributePropertyInfo)) {
                if (!((p instanceof CReferencePropertyInfo)
                        && ((CReferencePropertyInfo) p).isDummy())) {
                    xtw.propOrder(p.getName(false));
                }
            }
        }
    } else {
        // produce empty array
        xtw.getAnnotationUse().paramArray("propOrder");
    }

    for (CPropertyInfo prop : target.getProperties()) {
        generateFieldDecl(cc, prop);
    }

    if (target.declaresAttributeWildcard()) {
        generateAttributeWildcard(cc);
    }

    // generate some class level javadoc
    cc.ref.javadoc().append(target.javadoc);

    cc._package().objectFactoryGenerator().populate(cc);
}
 
Example #4
Source File: BeanGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Generates the body of a class.
 *
 */
private void generateClassBody(ClassOutlineImpl cc) {
    CClassInfo target = cc.target;

    // used to simplify the generated annotations
    String mostUsedNamespaceURI = cc._package().getMostUsedNamespaceURI();

    // [RESULT]
    // @XmlType(name="foo", targetNamespace="bar://baz")
    XmlTypeWriter xtw = cc.implClass.annotate2(XmlTypeWriter.class);
    writeTypeName(cc.target.getTypeName(), xtw, mostUsedNamespaceURI);

    if (model.options.target.isLaterThan(SpecVersion.V2_1)) {
        // @XmlSeeAlso
        Iterator<CClassInfo> subclasses = cc.target.listSubclasses();
        if (subclasses.hasNext()) {
            XmlSeeAlsoWriter saw = cc.implClass.annotate2(XmlSeeAlsoWriter.class);
            while (subclasses.hasNext()) {
                CClassInfo s = subclasses.next();
                saw.value(getClazz(s).implRef);
            }
        }
    }

    if (target.isElement()) {
        String namespaceURI = target.getElementName().getNamespaceURI();
        String localPart = target.getElementName().getLocalPart();

        // [RESULT]
        // @XmlRootElement(name="foo", targetNamespace="bar://baz")
        XmlRootElementWriter xrew = cc.implClass.annotate2(XmlRootElementWriter.class);
        xrew.name(localPart);
        if (!namespaceURI.equals(mostUsedNamespaceURI)) // only generate if necessary
        {
            xrew.namespace(namespaceURI);
        }
    }

    if (target.isOrdered()) {
        for (CPropertyInfo p : target.getProperties()) {
            if (!(p instanceof CAttributePropertyInfo)) {
                if (!((p instanceof CReferencePropertyInfo)
                        && ((CReferencePropertyInfo) p).isDummy())) {
                    xtw.propOrder(p.getName(false));
                }
            }
        }
    } else {
        // produce empty array
        xtw.getAnnotationUse().paramArray("propOrder");
    }

    for (CPropertyInfo prop : target.getProperties()) {
        generateFieldDecl(cc, prop);
    }

    if (target.declaresAttributeWildcard()) {
        generateAttributeWildcard(cc);
    }

    // generate some class level javadoc
    cc.ref.javadoc().append(target.javadoc);

    cc._package().objectFactoryGenerator().populate(cc);
}
 
Example #5
Source File: BeanGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Generates the body of a class.
 *
 */
private void generateClassBody(ClassOutlineImpl cc) {
    CClassInfo target = cc.target;

    // used to simplify the generated annotations
    String mostUsedNamespaceURI = cc._package().getMostUsedNamespaceURI();

    // [RESULT]
    // @XmlType(name="foo", targetNamespace="bar://baz")
    XmlTypeWriter xtw = cc.implClass.annotate2(XmlTypeWriter.class);
    writeTypeName(cc.target.getTypeName(), xtw, mostUsedNamespaceURI);

    if (model.options.target.isLaterThan(SpecVersion.V2_1)) {
        // @XmlSeeAlso
        Iterator<CClassInfo> subclasses = cc.target.listSubclasses();
        if (subclasses.hasNext()) {
            XmlSeeAlsoWriter saw = cc.implClass.annotate2(XmlSeeAlsoWriter.class);
            while (subclasses.hasNext()) {
                CClassInfo s = subclasses.next();
                saw.value(getClazz(s).implRef);
            }
        }
    }

    if (target.isElement()) {
        String namespaceURI = target.getElementName().getNamespaceURI();
        String localPart = target.getElementName().getLocalPart();

        // [RESULT]
        // @XmlRootElement(name="foo", targetNamespace="bar://baz")
        XmlRootElementWriter xrew = cc.implClass.annotate2(XmlRootElementWriter.class);
        xrew.name(localPart);
        if (!namespaceURI.equals(mostUsedNamespaceURI)) // only generate if necessary
        {
            xrew.namespace(namespaceURI);
        }
    }

    if (target.isOrdered()) {
        for (CPropertyInfo p : target.getProperties()) {
            if (!(p instanceof CAttributePropertyInfo)) {
                if (!((p instanceof CReferencePropertyInfo)
                        && ((CReferencePropertyInfo) p).isDummy())) {
                    xtw.propOrder(p.getName(false));
                }
            }
        }
    } else {
        // produce empty array
        xtw.getAnnotationUse().paramArray("propOrder");
    }

    for (CPropertyInfo prop : target.getProperties()) {
        generateFieldDecl(cc, prop);
    }

    if (target.declaresAttributeWildcard()) {
        generateAttributeWildcard(cc);
    }

    // generate some class level javadoc
    cc.ref.javadoc().append(target.javadoc);

    cc._package().objectFactoryGenerator().populate(cc);
}
 
Example #6
Source File: BeanGenerator.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Generates the body of a class.
 *
 */
private void generateClassBody(ClassOutlineImpl cc) {
    CClassInfo target = cc.target;

    // used to simplify the generated annotations
    String mostUsedNamespaceURI = cc._package().getMostUsedNamespaceURI();

    // [RESULT]
    // @XmlType(name="foo", targetNamespace="bar://baz")
    XmlTypeWriter xtw = cc.implClass.annotate2(XmlTypeWriter.class);
    writeTypeName(cc.target.getTypeName(), xtw, mostUsedNamespaceURI);

    if (model.options.target.isLaterThan(SpecVersion.V2_1)) {
        // @XmlSeeAlso
        Iterator<CClassInfo> subclasses = cc.target.listSubclasses();
        if (subclasses.hasNext()) {
            XmlSeeAlsoWriter saw = cc.implClass.annotate2(XmlSeeAlsoWriter.class);
            while (subclasses.hasNext()) {
                CClassInfo s = subclasses.next();
                saw.value(getClazz(s).implRef);
            }
        }
    }

    if (target.isElement()) {
        String namespaceURI = target.getElementName().getNamespaceURI();
        String localPart = target.getElementName().getLocalPart();

        // [RESULT]
        // @XmlRootElement(name="foo", targetNamespace="bar://baz")
        XmlRootElementWriter xrew = cc.implClass.annotate2(XmlRootElementWriter.class);
        xrew.name(localPart);
        if (!namespaceURI.equals(mostUsedNamespaceURI)) // only generate if necessary
        {
            xrew.namespace(namespaceURI);
        }
    }

    if (target.isOrdered()) {
        for (CPropertyInfo p : target.getProperties()) {
            if (!(p instanceof CAttributePropertyInfo)) {
                if (!((p instanceof CReferencePropertyInfo)
                        && ((CReferencePropertyInfo) p).isDummy())) {
                    xtw.propOrder(p.getName(false));
                }
            }
        }
    } else {
        // produce empty array
        xtw.getAnnotationUse().paramArray("propOrder");
    }

    for (CPropertyInfo prop : target.getProperties()) {
        generateFieldDecl(cc, prop);
    }

    if (target.declaresAttributeWildcard()) {
        generateAttributeWildcard(cc);
    }

    // generate some class level javadoc
    cc.ref.javadoc().append(target.javadoc);

    cc._package().objectFactoryGenerator().populate(cc);
}
 
Example #7
Source File: BeanGenerator.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Generates the body of a class.
 *
 */
private void generateClassBody(ClassOutlineImpl cc) {
    CClassInfo target = cc.target;

    // used to simplify the generated annotations
    String mostUsedNamespaceURI = cc._package().getMostUsedNamespaceURI();

    // [RESULT]
    // @XmlType(name="foo", targetNamespace="bar://baz")
    XmlTypeWriter xtw = cc.implClass.annotate2(XmlTypeWriter.class);
    writeTypeName(cc.target.getTypeName(), xtw, mostUsedNamespaceURI);

    if (model.options.target.isLaterThan(SpecVersion.V2_1)) {
        // @XmlSeeAlso
        Iterator<CClassInfo> subclasses = cc.target.listSubclasses();
        if (subclasses.hasNext()) {
            XmlSeeAlsoWriter saw = cc.implClass.annotate2(XmlSeeAlsoWriter.class);
            while (subclasses.hasNext()) {
                CClassInfo s = subclasses.next();
                saw.value(getClazz(s).implRef);
            }
        }
    }

    if (target.isElement()) {
        String namespaceURI = target.getElementName().getNamespaceURI();
        String localPart = target.getElementName().getLocalPart();

        // [RESULT]
        // @XmlRootElement(name="foo", targetNamespace="bar://baz")
        XmlRootElementWriter xrew = cc.implClass.annotate2(XmlRootElementWriter.class);
        xrew.name(localPart);
        if (!namespaceURI.equals(mostUsedNamespaceURI)) // only generate if necessary
        {
            xrew.namespace(namespaceURI);
        }
    }

    if (target.isOrdered()) {
        for (CPropertyInfo p : target.getProperties()) {
            if (!(p instanceof CAttributePropertyInfo)) {
                if (!((p instanceof CReferencePropertyInfo)
                        && ((CReferencePropertyInfo) p).isDummy())) {
                    xtw.propOrder(p.getName(false));
                }
            }
        }
    } else {
        // produce empty array
        xtw.getAnnotationUse().paramArray("propOrder");
    }

    for (CPropertyInfo prop : target.getProperties()) {
        generateFieldDecl(cc, prop);
    }

    if (target.declaresAttributeWildcard()) {
        generateAttributeWildcard(cc);
    }

    // generate some class level javadoc
    cc.ref.javadoc().append(target.javadoc);

    cc._package().objectFactoryGenerator().populate(cc);
}
 
Example #8
Source File: BeanGenerator.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Generates the body of a class.
 *
 */
private void generateClassBody(ClassOutlineImpl cc) {
    CClassInfo target = cc.target;

    // used to simplify the generated annotations
    String mostUsedNamespaceURI = cc._package().getMostUsedNamespaceURI();

    // [RESULT]
    // @XmlType(name="foo", targetNamespace="bar://baz")
    XmlTypeWriter xtw = cc.implClass.annotate2(XmlTypeWriter.class);
    writeTypeName(cc.target.getTypeName(), xtw, mostUsedNamespaceURI);

    if (model.options.target.isLaterThan(SpecVersion.V2_1)) {
        // @XmlSeeAlso
        Iterator<CClassInfo> subclasses = cc.target.listSubclasses();
        if (subclasses.hasNext()) {
            XmlSeeAlsoWriter saw = cc.implClass.annotate2(XmlSeeAlsoWriter.class);
            while (subclasses.hasNext()) {
                CClassInfo s = subclasses.next();
                saw.value(getClazz(s).implRef);
            }
        }
    }

    if (target.isElement()) {
        String namespaceURI = target.getElementName().getNamespaceURI();
        String localPart = target.getElementName().getLocalPart();

        // [RESULT]
        // @XmlRootElement(name="foo", targetNamespace="bar://baz")
        XmlRootElementWriter xrew = cc.implClass.annotate2(XmlRootElementWriter.class);
        xrew.name(localPart);
        if (!namespaceURI.equals(mostUsedNamespaceURI)) // only generate if necessary
        {
            xrew.namespace(namespaceURI);
        }
    }

    if (target.isOrdered()) {
        for (CPropertyInfo p : target.getProperties()) {
            if (!(p instanceof CAttributePropertyInfo)) {
                if (!((p instanceof CReferencePropertyInfo)
                        && ((CReferencePropertyInfo) p).isDummy())) {
                    xtw.propOrder(p.getName(false));
                }
            }
        }
    } else {
        // produce empty array
        xtw.getAnnotationUse().paramArray("propOrder");
    }

    for (CPropertyInfo prop : target.getProperties()) {
        generateFieldDecl(cc, prop);
    }

    if (target.declaresAttributeWildcard()) {
        generateAttributeWildcard(cc);
    }

    // generate some class level javadoc
    cc.ref.javadoc().append(target.javadoc);

    cc._package().objectFactoryGenerator().populate(cc);
}