com.sun.xml.internal.bind.v2.model.core.ClassInfo Java Examples

The following examples show how to use com.sun.xml.internal.bind.v2.model.core.ClassInfo. 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: XmlSchemaGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public XmlSchemaGenerator( Navigator<T,C,F,M> navigator, TypeInfoSet<T,C,F,M> types ) {
    this.navigator = navigator;
    this.types = types;

    this.stringType = types.getTypeInfo(navigator.ref(String.class));
    this.anyType = types.getAnyTypeInfo();

    // populate the object
    for( ClassInfo<T,C> ci : types.beans().values() )
        add(ci);
    for( ElementInfo<T,C> ei1 : types.getElementMappings(null).values() )
        add(ei1);
    for( EnumLeafInfo<T,C> ei : types.enums().values() )
        add(ei);
    for( ArrayInfo<T,C> a : types.arrays().values())
        add(a);
}
 
Example #2
Source File: XmlSchemaGenerator.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Process the given PropertyInfo looking for references to namespaces that
 * are foreign to the given namespace.  Any foreign namespace references
 * found are added to the given namespaces dependency list and an &lt;import>
 * is generated for it.
 *
 * @param p the PropertyInfo
 */
private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) {
    for (TypeInfo<T, C> t : p.ref()) {
        if ((t instanceof ClassInfo) && (processingDepth > 0)) {
            java.util.List<PropertyInfo> l = ((ClassInfo) t).getProperties();
            for (PropertyInfo subp : l) {
                processForeignNamespaces(subp, --processingDepth);
            }
        }
        if (t instanceof Element) {
            addDependencyTo(((Element) t).getElementName());
        }
        if (t instanceof NonElement) {
            addDependencyTo(((NonElement) t).getTypeName());
        }
    }
}
 
Example #3
Source File: XmlSchemaGenerator.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public XmlSchemaGenerator( Navigator<T,C,F,M> navigator, TypeInfoSet<T,C,F,M> types ) {
    this.navigator = navigator;
    this.types = types;

    this.stringType = types.getTypeInfo(navigator.ref(String.class));
    this.anyType = types.getAnyTypeInfo();

    // populate the object
    for( ClassInfo<T,C> ci : types.beans().values() )
        add(ci);
    for( ElementInfo<T,C> ei1 : types.getElementMappings(null).values() )
        add(ei1);
    for( EnumLeafInfo<T,C> ei : types.enums().values() )
        add(ei);
    for( ArrayInfo<T,C> a : types.arrays().values())
        add(a);
}
 
Example #4
Source File: XmlSchemaGenerator.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Process the given PropertyInfo looking for references to namespaces that
 * are foreign to the given namespace.  Any foreign namespace references
 * found are added to the given namespaces dependency list and an &lt;import>
 * is generated for it.
 *
 * @param p the PropertyInfo
 */
private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) {
    for (TypeInfo<T, C> t : p.ref()) {
        if ((t instanceof ClassInfo) && (processingDepth > 0)) {
            java.util.List<PropertyInfo> l = ((ClassInfo) t).getProperties();
            for (PropertyInfo subp : l) {
                processForeignNamespaces(subp, --processingDepth);
            }
        }
        if (t instanceof Element) {
            addDependencyTo(((Element) t).getElementName());
        }
        if (t instanceof NonElement) {
            addDependencyTo(((NonElement) t).getTypeName());
        }
    }
}
 
Example #5
Source File: XmlSchemaGenerator.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Process the given PropertyInfo looking for references to namespaces that
 * are foreign to the given namespace.  Any foreign namespace references
 * found are added to the given namespaces dependency list and an &lt;import>
 * is generated for it.
 *
 * @param p the PropertyInfo
 */
private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) {
    for (TypeInfo<T, C> t : p.ref()) {
        if ((t instanceof ClassInfo) && (processingDepth > 0)) {
            java.util.List<PropertyInfo> l = ((ClassInfo) t).getProperties();
            for (PropertyInfo subp : l) {
                processForeignNamespaces(subp, --processingDepth);
            }
        }
        if (t instanceof Element) {
            addDependencyTo(((Element) t).getElementName());
        }
        if (t instanceof NonElement) {
            addDependencyTo(((NonElement) t).getTypeName());
        }
    }
}
 
Example #6
Source File: XmlSchemaGenerator.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public XmlSchemaGenerator( Navigator<T,C,F,M> navigator, TypeInfoSet<T,C,F,M> types ) {
    this.navigator = navigator;
    this.types = types;

    this.stringType = types.getTypeInfo(navigator.ref(String.class));
    this.anyType = types.getAnyTypeInfo();

    // populate the object
    for( ClassInfo<T,C> ci : types.beans().values() )
        add(ci);
    for( ElementInfo<T,C> ei1 : types.getElementMappings(null).values() )
        add(ei1);
    for( EnumLeafInfo<T,C> ei : types.enums().values() )
        add(ei);
    for( ArrayInfo<T,C> a : types.arrays().values())
        add(a);
}
 
Example #7
Source File: XmlSchemaGenerator.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public XmlSchemaGenerator( Navigator<T,C,F,M> navigator, TypeInfoSet<T,C,F,M> types ) {
    this.navigator = navigator;
    this.types = types;

    this.stringType = types.getTypeInfo(navigator.ref(String.class));
    this.anyType = types.getAnyTypeInfo();

    // populate the object
    for( ClassInfo<T,C> ci : types.beans().values() )
        add(ci);
    for( ElementInfo<T,C> ei1 : types.getElementMappings(null).values() )
        add(ei1);
    for( EnumLeafInfo<T,C> ei : types.enums().values() )
        add(ei);
    for( ArrayInfo<T,C> a : types.arrays().values())
        add(a);
}
 
Example #8
Source File: XmlSchemaGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Process the given PropertyInfo looking for references to namespaces that
 * are foreign to the given namespace.  Any foreign namespace references
 * found are added to the given namespaces dependency list and an &lt;import>
 * is generated for it.
 *
 * @param p the PropertyInfo
 */
private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) {
    for (TypeInfo<T, C> t : p.ref()) {
        if ((t instanceof ClassInfo) && (processingDepth > 0)) {
            java.util.List<PropertyInfo> l = ((ClassInfo) t).getProperties();
            for (PropertyInfo subp : l) {
                processForeignNamespaces(subp, --processingDepth);
            }
        }
        if (t instanceof Element) {
            addDependencyTo(((Element) t).getElementName());
        }
        if (t instanceof NonElement) {
            addDependencyTo(((NonElement) t).getTypeName());
        }
    }
}
 
Example #9
Source File: XmlSchemaGenerator.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Process the given PropertyInfo looking for references to namespaces that
 * are foreign to the given namespace.  Any foreign namespace references
 * found are added to the given namespaces dependency list and an &lt;import>
 * is generated for it.
 *
 * @param p the PropertyInfo
 */
private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) {
    for (TypeInfo<T, C> t : p.ref()) {
        if ((t instanceof ClassInfo) && (processingDepth > 0)) {
            java.util.List<PropertyInfo> l = ((ClassInfo) t).getProperties();
            for (PropertyInfo subp : l) {
                processForeignNamespaces(subp, --processingDepth);
            }
        }
        if (t instanceof Element) {
            addDependencyTo(((Element) t).getElementName());
        }
        if (t instanceof NonElement) {
            addDependencyTo(((NonElement) t).getTypeName());
        }
    }
}
 
Example #10
Source File: XmlSchemaGenerator.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public XmlSchemaGenerator( Navigator<T,C,F,M> navigator, TypeInfoSet<T,C,F,M> types ) {
    this.navigator = navigator;
    this.types = types;

    this.stringType = types.getTypeInfo(navigator.ref(String.class));
    this.anyType = types.getAnyTypeInfo();

    // populate the object
    for( ClassInfo<T,C> ci : types.beans().values() )
        add(ci);
    for( ElementInfo<T,C> ei1 : types.getElementMappings(null).values() )
        add(ei1);
    for( EnumLeafInfo<T,C> ei : types.enums().values() )
        add(ei);
    for( ArrayInfo<T,C> a : types.arrays().values())
        add(a);
}
 
Example #11
Source File: XmlSchemaGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public XmlSchemaGenerator( Navigator<T,C,F,M> navigator, TypeInfoSet<T,C,F,M> types ) {
    this.navigator = navigator;
    this.types = types;

    this.stringType = types.getTypeInfo(navigator.ref(String.class));
    this.anyType = types.getAnyTypeInfo();

    // populate the object
    for( ClassInfo<T,C> ci : types.beans().values() )
        add(ci);
    for( ElementInfo<T,C> ei1 : types.getElementMappings(null).values() )
        add(ei1);
    for( EnumLeafInfo<T,C> ei : types.enums().values() )
        add(ei);
    for( ArrayInfo<T,C> a : types.arrays().values())
        add(a);
}
 
Example #12
Source File: XmlSchemaGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Process the given PropertyInfo looking for references to namespaces that
 * are foreign to the given namespace.  Any foreign namespace references
 * found are added to the given namespaces dependency list and an &lt;import>
 * is generated for it.
 *
 * @param p the PropertyInfo
 */
private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) {
    for (TypeInfo<T, C> t : p.ref()) {
        if ((t instanceof ClassInfo) && (processingDepth > 0)) {
            java.util.List<PropertyInfo> l = ((ClassInfo) t).getProperties();
            for (PropertyInfo subp : l) {
                processForeignNamespaces(subp, --processingDepth);
            }
        }
        if (t instanceof Element) {
            addDependencyTo(((Element) t).getElementName());
        }
        if (t instanceof NonElement) {
            addDependencyTo(((NonElement) t).getTypeName());
        }
    }
}
 
Example #13
Source File: XmlSchemaGenerator.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Process the given PropertyInfo looking for references to namespaces that
 * are foreign to the given namespace.  Any foreign namespace references
 * found are added to the given namespaces dependency list and an &lt;import>
 * is generated for it.
 *
 * @param p the PropertyInfo
 */
private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) {
    for (TypeInfo<T, C> t : p.ref()) {
        if ((t instanceof ClassInfo) && (processingDepth > 0)) {
            java.util.List<PropertyInfo> l = ((ClassInfo) t).getProperties();
            for (PropertyInfo subp : l) {
                processForeignNamespaces(subp, --processingDepth);
            }
        }
        if (t instanceof Element) {
            addDependencyTo(((Element) t).getElementName());
        }
        if (t instanceof NonElement) {
            addDependencyTo(((NonElement) t).getTypeName());
        }
    }
}
 
Example #14
Source File: XmlSchemaGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public XmlSchemaGenerator( Navigator<T,C,F,M> navigator, TypeInfoSet<T,C,F,M> types ) {
    this.navigator = navigator;
    this.types = types;

    this.stringType = types.getTypeInfo(navigator.ref(String.class));
    this.anyType = types.getAnyTypeInfo();

    // populate the object
    for( ClassInfo<T,C> ci : types.beans().values() )
        add(ci);
    for( ElementInfo<T,C> ei1 : types.getElementMappings(null).values() )
        add(ei1);
    for( EnumLeafInfo<T,C> ei : types.enums().values() )
        add(ei);
    for( ArrayInfo<T,C> a : types.arrays().values())
        add(a);
}
 
Example #15
Source File: XmlSchemaGenerator.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public XmlSchemaGenerator( Navigator<T,C,F,M> navigator, TypeInfoSet<T,C,F,M> types ) {
    this.navigator = navigator;
    this.types = types;

    this.stringType = types.getTypeInfo(navigator.ref(String.class));
    this.anyType = types.getAnyTypeInfo();

    // populate the object
    for( ClassInfo<T,C> ci : types.beans().values() )
        add(ci);
    for( ElementInfo<T,C> ei1 : types.getElementMappings(null).values() )
        add(ei1);
    for( EnumLeafInfo<T,C> ei : types.enums().values() )
        add(ei);
    for( ArrayInfo<T,C> a : types.arrays().values())
        add(a);
}
 
Example #16
Source File: XmlSchemaGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Process the given PropertyInfo looking for references to namespaces that
 * are foreign to the given namespace.  Any foreign namespace references
 * found are added to the given namespaces dependency list and an {@code <import>}
 * is generated for it.
 *
 * @param p the PropertyInfo
 */
private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) {
    for (TypeInfo<T, C> t : p.ref()) {
        if ((t instanceof ClassInfo) && (processingDepth > 0)) {
            java.util.List<PropertyInfo> l = ((ClassInfo) t).getProperties();
            for (PropertyInfo subp : l) {
                processForeignNamespaces(subp, --processingDepth);
            }
        }
        if (t instanceof Element) {
            addDependencyTo(((Element) t).getElementName());
        }
        if (t instanceof NonElement) {
            addDependencyTo(((NonElement) t).getTypeName());
        }
    }
}
 
Example #17
Source File: ReferencePropertyInfoImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private boolean addAllSubtypes(T type) {
    Navigator<T,C,F,M> nav = nav();

    // this allows the explicitly referenced type to be sucked in to the model
    NonElement<T,C> t = parent.builder.getClassInfo(nav.asDecl(type),this);
    if(!(t instanceof ClassInfo))
        // this is leaf.
        return false;

    boolean result = false;

    ClassInfo<T,C> c = (ClassInfo<T,C>) t;
    if(c.isElement()) {
        types.add(c.asElement());
        result = true;
    }

    // look for other possible types
    for( ClassInfo<T,C> ci : parent.owner.beans().values() ) {
        if(ci.isElement() && nav.isSubClassOf(ci.getType(),type)) {
            types.add(ci.asElement());
            result = true;
        }
    }

    // don't allow local elements to substitute.
    for( ElementInfo<T,C> ei : parent.owner.getElementMappings(null).values()) {
        if(nav.isSubClassOf(ei.getType(),type)) {
            types.add(ei);
            result = true;
        }
    }

    return result;
}
 
Example #18
Source File: ReferencePropertyInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private boolean addAllSubtypes(T type) {
    Navigator<T,C,F,M> nav = nav();

    // this allows the explicitly referenced type to be sucked in to the model
    NonElement<T,C> t = parent.builder.getClassInfo(nav.asDecl(type),this);
    if(!(t instanceof ClassInfo))
        // this is leaf.
        return false;

    boolean result = false;

    ClassInfo<T,C> c = (ClassInfo<T,C>) t;
    if(c.isElement()) {
        types.add(c.asElement());
        result = true;
    }

    // look for other possible types
    for( ClassInfo<T,C> ci : parent.owner.beans().values() ) {
        if(ci.isElement() && nav.isSubClassOf(ci.getType(),type)) {
            types.add(ci.asElement());
            result = true;
        }
    }

    // don't allow local elements to substitute.
    for( ElementInfo<T,C> ei : parent.owner.getElementMappings(null).values()) {
        if(nav.isSubClassOf(ei.getType(),type)) {
            types.add(ei);
            result = true;
        }
    }

    return result;
}
 
Example #19
Source File: ReferencePropertyInfoImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private boolean addAllSubtypes(T type) {
    Navigator<T,C,F,M> nav = nav();

    // this allows the explicitly referenced type to be sucked in to the model
    NonElement<T,C> t = parent.builder.getClassInfo(nav.asDecl(type),this);
    if(!(t instanceof ClassInfo))
        // this is leaf.
        return false;

    boolean result = false;

    ClassInfo<T,C> c = (ClassInfo<T,C>) t;
    if(c.isElement()) {
        types.add(c.asElement());
        result = true;
    }

    // look for other possible types
    for( ClassInfo<T,C> ci : parent.owner.beans().values() ) {
        if(ci.isElement() && nav.isSubClassOf(ci.getType(),type)) {
            types.add(ci.asElement());
            result = true;
        }
    }

    // don't allow local elements to substitute.
    for( ElementInfo<T,C> ei : parent.owner.getElementMappings(null).values()) {
        if(nav.isSubClassOf(ei.getType(),type)) {
            types.add(ei);
            result = true;
        }
    }

    return result;
}
 
Example #20
Source File: ReferencePropertyInfoImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean addAllSubtypes(T type) {
    Navigator<T,C,F,M> nav = nav();

    // this allows the explicitly referenced type to be sucked in to the model
    NonElement<T,C> t = parent.builder.getClassInfo(nav.asDecl(type),this);
    if(!(t instanceof ClassInfo))
        // this is leaf.
        return false;

    boolean result = false;

    ClassInfo<T,C> c = (ClassInfo<T,C>) t;
    if(c.isElement()) {
        types.add(c.asElement());
        result = true;
    }

    // look for other possible types
    for( ClassInfo<T,C> ci : parent.owner.beans().values() ) {
        if(ci.isElement() && nav.isSubClassOf(ci.getType(),type)) {
            types.add(ci.asElement());
            result = true;
        }
    }

    // don't allow local elements to substitute.
    for( ElementInfo<T,C> ei : parent.owner.getElementMappings(null).values()) {
        if(nav.isSubClassOf(ei.getType(),type)) {
            types.add(ei);
            result = true;
        }
    }

    return result;
}
 
Example #21
Source File: ReferencePropertyInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean addAllSubtypes(T type) {
    Navigator<T,C,F,M> nav = nav();

    // this allows the explicitly referenced type to be sucked in to the model
    NonElement<T,C> t = parent.builder.getClassInfo(nav.asDecl(type),this);
    if(!(t instanceof ClassInfo))
        // this is leaf.
        return false;

    boolean result = false;

    ClassInfo<T,C> c = (ClassInfo<T,C>) t;
    if(c.isElement()) {
        types.add(c.asElement());
        result = true;
    }

    // look for other possible types
    for( ClassInfo<T,C> ci : parent.owner.beans().values() ) {
        if(ci.isElement() && nav.isSubClassOf(ci.getType(),type)) {
            types.add(ci.asElement());
            result = true;
        }
    }

    // don't allow local elements to substitute.
    for( ElementInfo<T,C> ei : parent.owner.getElementMappings(null).values()) {
        if(nav.isSubClassOf(ei.getType(),type)) {
            types.add(ei);
            result = true;
        }
    }

    return result;
}
 
Example #22
Source File: ReferencePropertyInfoImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private boolean addAllSubtypes(T type) {
    Navigator<T,C,F,M> nav = nav();

    // this allows the explicitly referenced type to be sucked in to the model
    NonElement<T,C> t = parent.builder.getClassInfo(nav.asDecl(type),this);
    if(!(t instanceof ClassInfo))
        // this is leaf.
        return false;

    boolean result = false;

    ClassInfo<T,C> c = (ClassInfo<T,C>) t;
    if(c.isElement()) {
        types.add(c.asElement());
        result = true;
    }

    // look for other possible types
    for( ClassInfo<T,C> ci : parent.owner.beans().values() ) {
        if(ci.isElement() && nav.isSubClassOf(ci.getType(),type)) {
            types.add(ci.asElement());
            result = true;
        }
    }

    // don't allow local elements to substitute.
    for( ElementInfo<T,C> ei : parent.owner.getElementMappings(null).values()) {
        if(nav.isSubClassOf(ei.getType(),type)) {
            types.add(ei);
            result = true;
        }
    }

    return result;
}
 
Example #23
Source File: ReferencePropertyInfoImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private boolean addAllSubtypes(T type) {
    Navigator<T,C,F,M> nav = nav();

    // this allows the explicitly referenced type to be sucked in to the model
    NonElement<T,C> t = parent.builder.getClassInfo(nav.asDecl(type),this);
    if(!(t instanceof ClassInfo))
        // this is leaf.
        return false;

    boolean result = false;

    ClassInfo<T,C> c = (ClassInfo<T,C>) t;
    if(c.isElement()) {
        types.add(c.asElement());
        result = true;
    }

    // look for other possible types
    for( ClassInfo<T,C> ci : parent.owner.beans().values() ) {
        if(ci.isElement() && nav.isSubClassOf(ci.getType(),type)) {
            types.add(ci.asElement());
            result = true;
        }
    }

    // don't allow local elements to substitute.
    for( ElementInfo<T,C> ei : parent.owner.getElementMappings(null).values()) {
        if(nav.isSubClassOf(ei.getType(),type)) {
            types.add(ei);
            result = true;
        }
    }

    return result;
}
 
Example #24
Source File: ReferencePropertyInfoImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private boolean addAllSubtypes(T type) {
    Navigator<T,C,F,M> nav = nav();

    // this allows the explicitly referenced type to be sucked in to the model
    NonElement<T,C> t = parent.builder.getClassInfo(nav.asDecl(type),this);
    if(!(t instanceof ClassInfo))
        // this is leaf.
        return false;

    boolean result = false;

    ClassInfo<T,C> c = (ClassInfo<T,C>) t;
    if(c.isElement()) {
        types.add(c.asElement());
        result = true;
    }

    // look for other possible types
    for( ClassInfo<T,C> ci : parent.owner.beans().values() ) {
        if(ci.isElement() && nav.isSubClassOf(ci.getType(),type)) {
            types.add(ci.asElement());
            result = true;
        }
    }

    // don't allow local elements to substitute.
    for( ElementInfo<T,C> ei : parent.owner.getElementMappings(null).values()) {
        if(nav.isSubClassOf(ei.getType(),type)) {
            types.add(ei);
            result = true;
        }
    }

    return result;
}
 
Example #25
Source File: ClassInfoImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private void findFieldProperties(C c, XmlAccessType at) {

        // always find properties from the super class first
        C sc = nav().getSuperClass(c);
        if (shouldRecurseSuperClass(sc)) {
            findFieldProperties(sc,at);
        }

        for( F f : nav().getDeclaredFields(c) ) {
            Annotation[] annotations = reader().getAllFieldAnnotations(f,this);
            boolean isDummy = reader().hasFieldAnnotation(OverrideAnnotationOf.class, f);

            if( nav().isTransient(f) ) {
                // it's an error for transient field to have any binding annotation
                if(hasJAXBAnnotation(annotations))
                    builder.reportError(new IllegalAnnotationException(
                        Messages.TRANSIENT_FIELD_NOT_BINDABLE.format(nav().getFieldName(f)),
                            getSomeJAXBAnnotation(annotations)));
            } else
            if( nav().isStaticField(f) ) {
                // static fields are bound only when there's explicit annotation.
                if(hasJAXBAnnotation(annotations))
                    addProperty(createFieldSeed(f),annotations, false);
            } else {
                if(at==XmlAccessType.FIELD
                ||(at==XmlAccessType.PUBLIC_MEMBER && nav().isPublicField(f))
                || hasJAXBAnnotation(annotations)) {
                    if (isDummy) {
                        ClassInfo<T, C> top = getBaseClass();
                        while ((top != null) && (top.getProperty("content") == null)) {
                            top = top.getBaseClass();
                        }
                        DummyPropertyInfo prop = (DummyPropertyInfo) top.getProperty("content");
                        PropertySeed seed = createFieldSeed(f);
                        ((DummyPropertyInfo)prop).addType(createReferenceProperty(seed));
                    } else {
                        addProperty(createFieldSeed(f), annotations, false);
                    }
                }
                checkFieldXmlLocation(f);
            }
        }
    }
 
Example #26
Source File: ElementInfoImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public ClassInfo<T, C> getScope() {
    return scope;
}
 
Example #27
Source File: XmlSchemaGenerator.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Adds a new class to the list of classes to be written.
 *
 * <p>
 * A {@link ClassInfo} may have two namespaces --- one for the element name
 * and the other for the type name. If they are different, we put the same
 * {@link ClassInfo} to two {@link Namespace}s.
 */
public void add( ClassInfo<T,C> clazz ) {
    assert clazz!=null;

    String nsUri = null;

    if(clazz.getClazz()==navigator.asDecl(CompositeStructure.class))
        return; // this is a special class we introduced for JAX-WS that we *don't* want in the schema

    if(clazz.isElement()) {
        // put element -> type reference
        nsUri = clazz.getElementName().getNamespaceURI();
        Namespace ns = getNamespace(nsUri);
        ns.classes.add(clazz);
        ns.addDependencyTo(clazz.getTypeName());

        // schedule writing this global element
        add(clazz.getElementName(),false,clazz);
    }

    QName tn = clazz.getTypeName();
    if(tn!=null) {
        nsUri = tn.getNamespaceURI();
    } else {
        // anonymous type
        if(nsUri==null)
            return;
    }

    Namespace n = getNamespace(nsUri);
    n.classes.add(clazz);

    // search properties for foreign namespace references
    for( PropertyInfo<T,C> p : clazz.getProperties()) {
        n.processForeignNamespaces(p, 1);
        if (p instanceof AttributePropertyInfo) {
            AttributePropertyInfo<T,C> ap = (AttributePropertyInfo<T,C>) p;
            String aUri = ap.getXmlName().getNamespaceURI();
            if(aUri.length()>0) {
                // global attribute
                getNamespace(aUri).addGlobalAttribute(ap);
                n.addDependencyTo(ap.getXmlName());
            }
        }
        if (p instanceof ElementPropertyInfo) {
            ElementPropertyInfo<T,C> ep = (ElementPropertyInfo<T,C>) p;
            for (TypeRef<T,C> tref : ep.getTypes()) {
                String eUri = tref.getTagName().getNamespaceURI();
                if(eUri.length()>0 && !eUri.equals(n.uri)) {
                    getNamespace(eUri).addGlobalElement(tref);
                    n.addDependencyTo(tref.getTagName());
                }
            }
        }

        if(generateSwaRefAdapter(p))
            n.useSwaRef = true;

        MimeType mimeType = p.getExpectedMimeType();
        if( mimeType != null ) {
            n.useMimeNs = true;
        }

    }

    // recurse on baseTypes to make sure that we can refer to them in the schema
    ClassInfo<T,C> bc = clazz.getBaseClass();
    if (bc != null) {
        add(bc);
        n.addDependencyTo(bc.getTypeName());
    }
}
 
Example #28
Source File: ClassInfoImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void findFieldProperties(C c, XmlAccessType at) {

        // always find properties from the super class first
        C sc = nav().getSuperClass(c);
        if (shouldRecurseSuperClass(sc)) {
            findFieldProperties(sc,at);
        }

        for( F f : nav().getDeclaredFields(c) ) {
            Annotation[] annotations = reader().getAllFieldAnnotations(f,this);
            boolean isDummy = reader().hasFieldAnnotation(OverrideAnnotationOf.class, f);

            if( nav().isTransient(f) ) {
                // it's an error for transient field to have any binding annotation
                if(hasJAXBAnnotation(annotations))
                    builder.reportError(new IllegalAnnotationException(
                        Messages.TRANSIENT_FIELD_NOT_BINDABLE.format(nav().getFieldName(f)),
                            getSomeJAXBAnnotation(annotations)));
            } else
            if( nav().isStaticField(f) ) {
                // static fields are bound only when there's explicit annotation.
                if(hasJAXBAnnotation(annotations))
                    addProperty(createFieldSeed(f),annotations, false);
            } else {
                if(at==XmlAccessType.FIELD
                ||(at==XmlAccessType.PUBLIC_MEMBER && nav().isPublicField(f))
                || hasJAXBAnnotation(annotations)) {
                    if (isDummy) {
                        ClassInfo<T, C> top = getBaseClass();
                        while ((top != null) && (top.getProperty("content") == null)) {
                            top = top.getBaseClass();
                        }
                        DummyPropertyInfo prop = (DummyPropertyInfo) top.getProperty("content");
                        PropertySeed seed = createFieldSeed(f);
                        ((DummyPropertyInfo)prop).addType(createReferenceProperty(seed));
                    } else {
                        addProperty(createFieldSeed(f), annotations, false);
                    }
                }
                checkFieldXmlLocation(f);
            }
        }
    }
 
Example #29
Source File: ElementInfoImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public ClassInfo<T, C> getScope() {
    return scope;
}
 
Example #30
Source File: ElementInfoImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public ClassInfo<T, C> getScope() {
    return scope;
}