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

The following examples show how to use com.sun.xml.internal.bind.v2.model.core.TypeInfoSet. 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: ModelBuilder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called after all the classes are added to the type set
 * to "link" them together.
 *
 * <p>
 * Don't expose implementation classes in the signature.
 *
 * @return
 *      fully built {@link TypeInfoSet} that represents the model,
 *      or null if there was an error.
 */
public TypeInfoSet<T,C,F,M> link() {

    assert !linked;
    linked = true;

    for( ElementInfoImpl ei : typeInfoSet.getAllElements() )
        ei.link();

    for( ClassInfoImpl ci : typeInfoSet.beans().values() )
        ci.link();

    for( EnumLeafInfoImpl li : typeInfoSet.enums().values() )
        li.link();

    if(hadError)
        return null;
    else
        return typeInfoSet;
}
 
Example #2
Source File: ModelBuilder.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called after all the classes are added to the type set
 * to "link" them together.
 *
 * <p>
 * Don't expose implementation classes in the signature.
 *
 * @return
 *      fully built {@link TypeInfoSet} that represents the model,
 *      or null if there was an error.
 */
public TypeInfoSet<T,C,F,M> link() {

    assert !linked;
    linked = true;

    for( ElementInfoImpl ei : typeInfoSet.getAllElements() )
        ei.link();

    for( ClassInfoImpl ci : typeInfoSet.beans().values() )
        ci.link();

    for( EnumLeafInfoImpl li : typeInfoSet.enums().values() )
        li.link();

    if(hadError)
        return null;
    else
        return typeInfoSet;
}
 
Example #3
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 #4
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 #5
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 #6
Source File: ModelBuilder.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called after all the classes are added to the type set
 * to "link" them together.
 *
 * <p>
 * Don't expose implementation classes in the signature.
 *
 * @return
 *      fully built {@link TypeInfoSet} that represents the model,
 *      or null if there was an error.
 */
public TypeInfoSet<T,C,F,M> link() {

    assert !linked;
    linked = true;

    for( ElementInfoImpl ei : typeInfoSet.getAllElements() )
        ei.link();

    for( ClassInfoImpl ci : typeInfoSet.beans().values() )
        ci.link();

    for( EnumLeafInfoImpl li : typeInfoSet.enums().values() )
        li.link();

    if(hadError)
        return null;
    else
        return typeInfoSet;
}
 
Example #7
Source File: ModelBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called after all the classes are added to the type set
 * to "link" them together.
 *
 * <p>
 * Don't expose implementation classes in the signature.
 *
 * @return
 *      fully built {@link TypeInfoSet} that represents the model,
 *      or null if there was an error.
 */
public TypeInfoSet<T,C,F,M> link() {

    assert !linked;
    linked = true;

    for( ElementInfoImpl ei : typeInfoSet.getAllElements() )
        ei.link();

    for( ClassInfoImpl ci : typeInfoSet.beans().values() )
        ci.link();

    for( EnumLeafInfoImpl li : typeInfoSet.enums().values() )
        li.link();

    if(hadError)
        return null;
    else
        return typeInfoSet;
}
 
Example #8
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 #9
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 #10
Source File: ModelBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called after all the classes are added to the type set
 * to "link" them together.
 *
 * <p>
 * Don't expose implementation classes in the signature.
 *
 * @return
 *      fully built {@link TypeInfoSet} that represents the model,
 *      or null if there was an error.
 */
public TypeInfoSet<T,C,F,M> link() {

    assert !linked;
    linked = true;

    for( ElementInfoImpl ei : typeInfoSet.getAllElements() )
        ei.link();

    for( ClassInfoImpl ci : typeInfoSet.beans().values() )
        ci.link();

    for( EnumLeafInfoImpl li : typeInfoSet.enums().values() )
        li.link();

    if(hadError)
        return null;
    else
        return typeInfoSet;
}
 
Example #11
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 #12
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 #13
Source File: ModelBuilder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called after all the classes are added to the type set
 * to "link" them together.
 *
 * <p>
 * Don't expose implementation classes in the signature.
 *
 * @return
 *      fully built {@link TypeInfoSet} that represents the model,
 *      or null if there was an error.
 */
public TypeInfoSet<T,C,F,M> link() {

    assert !linked;
    linked = true;

    for( ElementInfoImpl ei : typeInfoSet.getAllElements() )
        ei.link();

    for( ClassInfoImpl ci : typeInfoSet.beans().values() )
        ci.link();

    for( EnumLeafInfoImpl li : typeInfoSet.enums().values() )
        li.link();

    if(hadError)
        return null;
    else
        return typeInfoSet;
}
 
Example #14
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 #15
Source File: ModelBuilder.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called after all the classes are added to the type set
 * to "link" them together.
 *
 * <p>
 * Don't expose implementation classes in the signature.
 *
 * @return
 *      fully built {@link TypeInfoSet} that represents the model,
 *      or null if there was an error.
 */
public TypeInfoSet<T,C,F,M> link() {

    assert !linked;
    linked = true;

    for( ElementInfoImpl ei : typeInfoSet.getAllElements() )
        ei.link();

    for( ClassInfoImpl ci : typeInfoSet.beans().values() )
        ci.link();

    for( EnumLeafInfoImpl li : typeInfoSet.enums().values() )
        li.link();

    if(hadError)
        return null;
    else
        return typeInfoSet;
}
 
Example #16
Source File: ModelBuilder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called after all the classes are added to the type set
 * to "link" them together.
 *
 * <p>
 * Don't expose implementation classes in the signature.
 *
 * @return
 *      fully built {@link TypeInfoSet} that represents the model,
 *      or null if there was an error.
 */
public TypeInfoSet<T,C,F,M> link() {

    assert !linked;
    linked = true;

    for( ElementInfoImpl ei : typeInfoSet.getAllElements() )
        ei.link();

    for( ClassInfoImpl ci : typeInfoSet.beans().values() )
        ci.link();

    for( EnumLeafInfoImpl li : typeInfoSet.enums().values() )
        li.link();

    if(hadError)
        return null;
    else
        return typeInfoSet;
}
 
Example #17
Source File: JavaCompilerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public J2SJAXBModel bind(
    Collection<Reference> rootClasses,
    Map<QName,Reference> additionalElementDecls,
    String defaultNamespaceRemap,
    ProcessingEnvironment env) {

    ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement> builder =
            new ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement>(
            InlineAnnotationReaderImpl.theInstance,
            new ApNavigator(env),
            Collections.<TypeElement, TypeElement>emptyMap(),
            defaultNamespaceRemap );

    builder.setErrorHandler(new ErrorHandlerImpl(env.getMessager()));

    for ( Reference ref : rootClasses ) {
        TypeMirror t = ref.type;

        XmlJavaTypeAdapter xjta = ref.annotations.getAnnotation(XmlJavaTypeAdapter.class);
        XmlList xl = ref.annotations.getAnnotation(XmlList.class);

        builder.getTypeInfo(new Ref<TypeMirror, TypeElement>(builder, t, xjta, xl));
    }

    TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> r = builder.link();
    if(r==null)     return null;

    if(additionalElementDecls==null)
        additionalElementDecls = Collections.emptyMap();
    else {
        // fool proof check
        for (Map.Entry<QName, ? extends Reference> e : additionalElementDecls.entrySet()) {
            if(e.getKey()==null)
                throw new IllegalArgumentException("nulls in additionalElementDecls");
        }
    }
    return new JAXBModelImpl(r, builder.reader, rootClasses, new HashMap<QName, Reference>(additionalElementDecls));
}
 
Example #18
Source File: JavaCompilerImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public J2SJAXBModel bind(
    Collection<Reference> rootClasses,
    Map<QName,Reference> additionalElementDecls,
    String defaultNamespaceRemap,
    ProcessingEnvironment env) {

    ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement> builder =
            new ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement>(
            InlineAnnotationReaderImpl.theInstance,
            new ApNavigator(env),
            Collections.<TypeElement, TypeElement>emptyMap(),
            defaultNamespaceRemap );

    builder.setErrorHandler(new ErrorHandlerImpl(env.getMessager()));

    for ( Reference ref : rootClasses ) {
        TypeMirror t = ref.type;

        XmlJavaTypeAdapter xjta = ref.annotations.getAnnotation(XmlJavaTypeAdapter.class);
        XmlList xl = ref.annotations.getAnnotation(XmlList.class);

        builder.getTypeInfo(new Ref<TypeMirror, TypeElement>(builder, t, xjta, xl));
    }

    TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> r = builder.link();
    if(r==null)     return null;

    if(additionalElementDecls==null)
        additionalElementDecls = Collections.emptyMap();
    else {
        // fool proof check
        for (Map.Entry<QName, ? extends Reference> e : additionalElementDecls.entrySet()) {
            if(e.getKey()==null)
                throw new IllegalArgumentException("nulls in additionalElementDecls");
        }
    }
    return new JAXBModelImpl(r, builder.reader, rootClasses, new HashMap<QName, Reference>(additionalElementDecls));
}
 
Example #19
Source File: JavaCompilerImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public J2SJAXBModel bind(
    Collection<Reference> rootClasses,
    Map<QName,Reference> additionalElementDecls,
    String defaultNamespaceRemap,
    ProcessingEnvironment env) {

    ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement> builder =
            new ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement>(
            InlineAnnotationReaderImpl.theInstance,
            new ApNavigator(env),
            Collections.<TypeElement, TypeElement>emptyMap(),
            defaultNamespaceRemap );

    builder.setErrorHandler(new ErrorHandlerImpl(env.getMessager()));

    for ( Reference ref : rootClasses ) {
        TypeMirror t = ref.type;

        XmlJavaTypeAdapter xjta = ref.annotations.getAnnotation(XmlJavaTypeAdapter.class);
        XmlList xl = ref.annotations.getAnnotation(XmlList.class);

        builder.getTypeInfo(new Ref<TypeMirror, TypeElement>(builder, t, xjta, xl));
    }

    TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> r = builder.link();
    if(r==null)     return null;

    if(additionalElementDecls==null)
        additionalElementDecls = Collections.emptyMap();
    else {
        // fool proof check
        for (Map.Entry<QName, ? extends Reference> e : additionalElementDecls.entrySet()) {
            if(e.getKey()==null)
                throw new IllegalArgumentException("nulls in additionalElementDecls");
        }
    }
    return new JAXBModelImpl(r, builder.reader, rootClasses, new HashMap<QName, Reference>(additionalElementDecls));
}
 
Example #20
Source File: JavaCompilerImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public J2SJAXBModel bind(
    Collection<Reference> rootClasses,
    Map<QName,Reference> additionalElementDecls,
    String defaultNamespaceRemap,
    ProcessingEnvironment env) {

    ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement> builder =
            new ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement>(
            InlineAnnotationReaderImpl.theInstance,
            new ApNavigator(env),
            Collections.<TypeElement, TypeElement>emptyMap(),
            defaultNamespaceRemap );

    builder.setErrorHandler(new ErrorHandlerImpl(env.getMessager()));

    for ( Reference ref : rootClasses ) {
        TypeMirror t = ref.type;

        XmlJavaTypeAdapter xjta = ref.annotations.getAnnotation(XmlJavaTypeAdapter.class);
        XmlList xl = ref.annotations.getAnnotation(XmlList.class);

        builder.getTypeInfo(new Ref<TypeMirror, TypeElement>(builder, t, xjta, xl));
    }

    TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> r = builder.link();
    if(r==null)     return null;

    if(additionalElementDecls==null)
        additionalElementDecls = Collections.emptyMap();
    else {
        // fool proof check
        for (Map.Entry<QName, ? extends Reference> e : additionalElementDecls.entrySet()) {
            if(e.getKey()==null)
                throw new IllegalArgumentException("nulls in additionalElementDecls");
        }
    }
    return new JAXBModelImpl(r, builder.reader, rootClasses, new HashMap<QName, Reference>(additionalElementDecls));
}
 
Example #21
Source File: JavaCompilerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public J2SJAXBModel bind(
    Collection<Reference> rootClasses,
    Map<QName,Reference> additionalElementDecls,
    String defaultNamespaceRemap,
    ProcessingEnvironment env) {

    ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement> builder =
            new ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement>(
            InlineAnnotationReaderImpl.theInstance,
            new ApNavigator(env),
            Collections.<TypeElement, TypeElement>emptyMap(),
            defaultNamespaceRemap );

    builder.setErrorHandler(new ErrorHandlerImpl(env.getMessager()));

    for ( Reference ref : rootClasses ) {
        TypeMirror t = ref.type;

        XmlJavaTypeAdapter xjta = ref.annotations.getAnnotation(XmlJavaTypeAdapter.class);
        XmlList xl = ref.annotations.getAnnotation(XmlList.class);

        builder.getTypeInfo(new Ref<TypeMirror, TypeElement>(builder, t, xjta, xl));
    }

    TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> r = builder.link();
    if(r==null)     return null;

    if(additionalElementDecls==null)
        additionalElementDecls = Collections.emptyMap();
    else {
        // fool proof check
        for (Map.Entry<QName, ? extends Reference> e : additionalElementDecls.entrySet()) {
            if(e.getKey()==null)
                throw new IllegalArgumentException("nulls in additionalElementDecls");
        }
    }
    return new JAXBModelImpl(r, builder.reader, rootClasses, new HashMap<QName, Reference>(additionalElementDecls));
}
 
Example #22
Source File: JavaCompilerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public J2SJAXBModel bind(
    Collection<Reference> rootClasses,
    Map<QName,Reference> additionalElementDecls,
    String defaultNamespaceRemap,
    ProcessingEnvironment env) {

    ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement> builder =
            new ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement>(
            InlineAnnotationReaderImpl.theInstance,
            new ApNavigator(env),
            Collections.<TypeElement, TypeElement>emptyMap(),
            defaultNamespaceRemap );

    builder.setErrorHandler(new ErrorHandlerImpl(env.getMessager()));

    for ( Reference ref : rootClasses ) {
        TypeMirror t = ref.type;

        XmlJavaTypeAdapter xjta = ref.annotations.getAnnotation(XmlJavaTypeAdapter.class);
        XmlList xl = ref.annotations.getAnnotation(XmlList.class);

        builder.getTypeInfo(new Ref<TypeMirror, TypeElement>(builder, t, xjta, xl));
    }

    TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> r = builder.link();
    if(r==null)     return null;

    if(additionalElementDecls==null)
        additionalElementDecls = Collections.emptyMap();
    else {
        // fool proof check
        for (Map.Entry<QName, ? extends Reference> e : additionalElementDecls.entrySet()) {
            if(e.getKey()==null)
                throw new IllegalArgumentException("nulls in additionalElementDecls");
        }
    }
    return new JAXBModelImpl(r, builder.reader, rootClasses, new HashMap<QName, Reference>(additionalElementDecls));
}
 
Example #23
Source File: JavaCompilerImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public J2SJAXBModel bind(
    Collection<Reference> rootClasses,
    Map<QName,Reference> additionalElementDecls,
    String defaultNamespaceRemap,
    ProcessingEnvironment env) {

    ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement> builder =
            new ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement>(
            InlineAnnotationReaderImpl.theInstance,
            new ApNavigator(env),
            Collections.<TypeElement, TypeElement>emptyMap(),
            defaultNamespaceRemap );

    builder.setErrorHandler(new ErrorHandlerImpl(env.getMessager()));

    for ( Reference ref : rootClasses ) {
        TypeMirror t = ref.type;

        XmlJavaTypeAdapter xjta = ref.annotations.getAnnotation(XmlJavaTypeAdapter.class);
        XmlList xl = ref.annotations.getAnnotation(XmlList.class);

        builder.getTypeInfo(new Ref<TypeMirror, TypeElement>(builder, t, xjta, xl));
    }

    TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> r = builder.link();
    if(r==null)     return null;

    if(additionalElementDecls==null)
        additionalElementDecls = Collections.emptyMap();
    else {
        // fool proof check
        for (Map.Entry<QName, ? extends Reference> e : additionalElementDecls.entrySet()) {
            if(e.getKey()==null)
                throw new IllegalArgumentException("nulls in additionalElementDecls");
        }
    }
    return new JAXBModelImpl(r, builder.reader, rootClasses, new HashMap<QName, Reference>(additionalElementDecls));
}
 
Example #24
Source File: JavaCompilerImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public J2SJAXBModel bind(
    Collection<Reference> rootClasses,
    Map<QName,Reference> additionalElementDecls,
    String defaultNamespaceRemap,
    ProcessingEnvironment env) {

    ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement> builder =
            new ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement>(
            InlineAnnotationReaderImpl.theInstance,
            new ApNavigator(env),
            Collections.<TypeElement, TypeElement>emptyMap(),
            defaultNamespaceRemap );

    builder.setErrorHandler(new ErrorHandlerImpl(env.getMessager()));

    for ( Reference ref : rootClasses ) {
        TypeMirror t = ref.type;

        XmlJavaTypeAdapter xjta = ref.annotations.getAnnotation(XmlJavaTypeAdapter.class);
        XmlList xl = ref.annotations.getAnnotation(XmlList.class);

        builder.getTypeInfo(new Ref<TypeMirror, TypeElement>(builder, t, xjta, xl));
    }

    TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> r = builder.link();
    if(r==null)     return null;

    if(additionalElementDecls==null)
        additionalElementDecls = Collections.emptyMap();
    else {
        // fool proof check
        for (Map.Entry<QName, ? extends Reference> e : additionalElementDecls.entrySet()) {
            if(e.getKey()==null)
                throw new IllegalArgumentException("nulls in additionalElementDecls");
        }
    }
    return new JAXBModelImpl(r, builder.reader, rootClasses, new HashMap<QName, Reference>(additionalElementDecls));
}
 
Example #25
Source File: JAXBModelImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public JAXBModelImpl(TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> types,
                     AnnotationReader<TypeMirror, TypeElement, VariableElement, ExecutableElement> reader,
                     Collection<Reference> rootClasses,
                     Map<QName, Reference> additionalElementDecls) {
    this.types = types;
    this.reader = reader;
    this.additionalElementDecls = additionalElementDecls;

    Navigator<TypeMirror, TypeElement, VariableElement, ExecutableElement> navigator = types.getNavigator();

    for (ClassInfo<TypeMirror, TypeElement> i : types.beans().values()) {
        classList.add(i.getName());
    }

    for (ArrayInfo<TypeMirror, TypeElement> a : types.arrays().values()) {
        String javaName = navigator.getTypeName(a.getType());
        classList.add(javaName);
    }

    for (EnumLeafInfo<TypeMirror, TypeElement> l : types.enums().values()) {
        QName tn = l.getTypeName();
        if(tn!=null) {
            String javaName = navigator.getTypeName(l.getType());
            classList.add(javaName);
        }
    }

    for (Reference ref : rootClasses)
        refMap.put(ref,getXmlType(ref));

    // check for collision between "additional" ones and the ones given to JAXB
    // and eliminate duplication
    Iterator<Map.Entry<QName, Reference>> itr = additionalElementDecls.entrySet().iterator();
    while(itr.hasNext()) {
        Map.Entry<QName, Reference> entry = itr.next();
        if(entry.getValue()==null)      continue;

        NonElement<TypeMirror, TypeElement> xt = getXmlType(entry.getValue());

        assert xt!=null;
        refMap.put(entry.getValue(),xt);
        if(xt instanceof ClassInfo) {
            ClassInfo<TypeMirror, TypeElement> xct = (ClassInfo<TypeMirror, TypeElement>) xt;
            Element<TypeMirror, TypeElement> elem = xct.asElement();
            if(elem!=null && elem.getElementName().equals(entry.getKey())) {
                itr.remove();
                continue;
            }
        }
        ElementInfo<TypeMirror, TypeElement> ei = types.getElementInfo(null, entry.getKey());
        if(ei!=null && ei.getContentType()==xt)
            itr.remove();
    }
}
 
Example #26
Source File: JAXBModelImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public JAXBModelImpl(TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> types,
                     AnnotationReader<TypeMirror, TypeElement, VariableElement, ExecutableElement> reader,
                     Collection<Reference> rootClasses,
                     Map<QName, Reference> additionalElementDecls) {
    this.types = types;
    this.reader = reader;
    this.additionalElementDecls = additionalElementDecls;

    Navigator<TypeMirror, TypeElement, VariableElement, ExecutableElement> navigator = types.getNavigator();

    for (ClassInfo<TypeMirror, TypeElement> i : types.beans().values()) {
        classList.add(i.getName());
    }

    for (ArrayInfo<TypeMirror, TypeElement> a : types.arrays().values()) {
        String javaName = navigator.getTypeName(a.getType());
        classList.add(javaName);
    }

    for (EnumLeafInfo<TypeMirror, TypeElement> l : types.enums().values()) {
        QName tn = l.getTypeName();
        if(tn!=null) {
            String javaName = navigator.getTypeName(l.getType());
            classList.add(javaName);
        }
    }

    for (Reference ref : rootClasses)
        refMap.put(ref,getXmlType(ref));

    // check for collision between "additional" ones and the ones given to JAXB
    // and eliminate duplication
    Iterator<Map.Entry<QName, Reference>> itr = additionalElementDecls.entrySet().iterator();
    while(itr.hasNext()) {
        Map.Entry<QName, Reference> entry = itr.next();
        if(entry.getValue()==null)      continue;

        NonElement<TypeMirror, TypeElement> xt = getXmlType(entry.getValue());

        assert xt!=null;
        refMap.put(entry.getValue(),xt);
        if(xt instanceof ClassInfo) {
            ClassInfo<TypeMirror, TypeElement> xct = (ClassInfo<TypeMirror, TypeElement>) xt;
            Element<TypeMirror, TypeElement> elem = xct.asElement();
            if(elem!=null && elem.getElementName().equals(entry.getKey())) {
                itr.remove();
                continue;
            }
        }
        ElementInfo<TypeMirror, TypeElement> ei = types.getElementInfo(null, entry.getKey());
        if(ei!=null && ei.getContentType()==xt)
            itr.remove();
    }
}
 
Example #27
Source File: JAXBModelImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public JAXBModelImpl(TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> types,
                     AnnotationReader<TypeMirror, TypeElement, VariableElement, ExecutableElement> reader,
                     Collection<Reference> rootClasses,
                     Map<QName, Reference> additionalElementDecls) {
    this.types = types;
    this.reader = reader;
    this.additionalElementDecls = additionalElementDecls;

    Navigator<TypeMirror, TypeElement, VariableElement, ExecutableElement> navigator = types.getNavigator();

    for (ClassInfo<TypeMirror, TypeElement> i : types.beans().values()) {
        classList.add(i.getName());
    }

    for (ArrayInfo<TypeMirror, TypeElement> a : types.arrays().values()) {
        String javaName = navigator.getTypeName(a.getType());
        classList.add(javaName);
    }

    for (EnumLeafInfo<TypeMirror, TypeElement> l : types.enums().values()) {
        QName tn = l.getTypeName();
        if(tn!=null) {
            String javaName = navigator.getTypeName(l.getType());
            classList.add(javaName);
        }
    }

    for (Reference ref : rootClasses)
        refMap.put(ref,getXmlType(ref));

    // check for collision between "additional" ones and the ones given to JAXB
    // and eliminate duplication
    Iterator<Map.Entry<QName, Reference>> itr = additionalElementDecls.entrySet().iterator();
    while(itr.hasNext()) {
        Map.Entry<QName, Reference> entry = itr.next();
        if(entry.getValue()==null)      continue;

        NonElement<TypeMirror, TypeElement> xt = getXmlType(entry.getValue());

        assert xt!=null;
        refMap.put(entry.getValue(),xt);
        if(xt instanceof ClassInfo) {
            ClassInfo<TypeMirror, TypeElement> xct = (ClassInfo<TypeMirror, TypeElement>) xt;
            Element<TypeMirror, TypeElement> elem = xct.asElement();
            if(elem!=null && elem.getElementName().equals(entry.getKey())) {
                itr.remove();
                continue;
            }
        }
        ElementInfo<TypeMirror, TypeElement> ei = types.getElementInfo(null, entry.getKey());
        if(ei!=null && ei.getContentType()==xt)
            itr.remove();
    }
}
 
Example #28
Source File: JAXBModelImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public JAXBModelImpl(TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> types,
                     AnnotationReader<TypeMirror, TypeElement, VariableElement, ExecutableElement> reader,
                     Collection<Reference> rootClasses,
                     Map<QName, Reference> additionalElementDecls) {
    this.types = types;
    this.reader = reader;
    this.additionalElementDecls = additionalElementDecls;

    Navigator<TypeMirror, TypeElement, VariableElement, ExecutableElement> navigator = types.getNavigator();

    for (ClassInfo<TypeMirror, TypeElement> i : types.beans().values()) {
        classList.add(i.getName());
    }

    for (ArrayInfo<TypeMirror, TypeElement> a : types.arrays().values()) {
        String javaName = navigator.getTypeName(a.getType());
        classList.add(javaName);
    }

    for (EnumLeafInfo<TypeMirror, TypeElement> l : types.enums().values()) {
        QName tn = l.getTypeName();
        if(tn!=null) {
            String javaName = navigator.getTypeName(l.getType());
            classList.add(javaName);
        }
    }

    for (Reference ref : rootClasses)
        refMap.put(ref,getXmlType(ref));

    // check for collision between "additional" ones and the ones given to JAXB
    // and eliminate duplication
    Iterator<Map.Entry<QName, Reference>> itr = additionalElementDecls.entrySet().iterator();
    while(itr.hasNext()) {
        Map.Entry<QName, Reference> entry = itr.next();
        if(entry.getValue()==null)      continue;

        NonElement<TypeMirror, TypeElement> xt = getXmlType(entry.getValue());

        assert xt!=null;
        refMap.put(entry.getValue(),xt);
        if(xt instanceof ClassInfo) {
            ClassInfo<TypeMirror, TypeElement> xct = (ClassInfo<TypeMirror, TypeElement>) xt;
            Element<TypeMirror, TypeElement> elem = xct.asElement();
            if(elem!=null && elem.getElementName().equals(entry.getKey())) {
                itr.remove();
                continue;
            }
        }
        ElementInfo<TypeMirror, TypeElement> ei = types.getElementInfo(null, entry.getKey());
        if(ei!=null && ei.getContentType()==xt)
            itr.remove();
    }
}
 
Example #29
Source File: JAXBModelImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public JAXBModelImpl(TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> types,
                     AnnotationReader<TypeMirror, TypeElement, VariableElement, ExecutableElement> reader,
                     Collection<Reference> rootClasses,
                     Map<QName, Reference> additionalElementDecls) {
    this.types = types;
    this.reader = reader;
    this.additionalElementDecls = additionalElementDecls;

    Navigator<TypeMirror, TypeElement, VariableElement, ExecutableElement> navigator = types.getNavigator();

    for (ClassInfo<TypeMirror, TypeElement> i : types.beans().values()) {
        classList.add(i.getName());
    }

    for (ArrayInfo<TypeMirror, TypeElement> a : types.arrays().values()) {
        String javaName = navigator.getTypeName(a.getType());
        classList.add(javaName);
    }

    for (EnumLeafInfo<TypeMirror, TypeElement> l : types.enums().values()) {
        QName tn = l.getTypeName();
        if(tn!=null) {
            String javaName = navigator.getTypeName(l.getType());
            classList.add(javaName);
        }
    }

    for (Reference ref : rootClasses)
        refMap.put(ref,getXmlType(ref));

    // check for collision between "additional" ones and the ones given to JAXB
    // and eliminate duplication
    Iterator<Map.Entry<QName, Reference>> itr = additionalElementDecls.entrySet().iterator();
    while(itr.hasNext()) {
        Map.Entry<QName, Reference> entry = itr.next();
        if(entry.getValue()==null)      continue;

        NonElement<TypeMirror, TypeElement> xt = getXmlType(entry.getValue());

        assert xt!=null;
        refMap.put(entry.getValue(),xt);
        if(xt instanceof ClassInfo) {
            ClassInfo<TypeMirror, TypeElement> xct = (ClassInfo<TypeMirror, TypeElement>) xt;
            Element<TypeMirror, TypeElement> elem = xct.asElement();
            if(elem!=null && elem.getElementName().equals(entry.getKey())) {
                itr.remove();
                continue;
            }
        }
        ElementInfo<TypeMirror, TypeElement> ei = types.getElementInfo(null, entry.getKey());
        if(ei!=null && ei.getContentType()==xt)
            itr.remove();
    }
}
 
Example #30
Source File: JAXBModelImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public JAXBModelImpl(TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> types,
                     AnnotationReader<TypeMirror, TypeElement, VariableElement, ExecutableElement> reader,
                     Collection<Reference> rootClasses,
                     Map<QName, Reference> additionalElementDecls) {
    this.types = types;
    this.reader = reader;
    this.additionalElementDecls = additionalElementDecls;

    Navigator<TypeMirror, TypeElement, VariableElement, ExecutableElement> navigator = types.getNavigator();

    for (ClassInfo<TypeMirror, TypeElement> i : types.beans().values()) {
        classList.add(i.getName());
    }

    for (ArrayInfo<TypeMirror, TypeElement> a : types.arrays().values()) {
        String javaName = navigator.getTypeName(a.getType());
        classList.add(javaName);
    }

    for (EnumLeafInfo<TypeMirror, TypeElement> l : types.enums().values()) {
        QName tn = l.getTypeName();
        if(tn!=null) {
            String javaName = navigator.getTypeName(l.getType());
            classList.add(javaName);
        }
    }

    for (Reference ref : rootClasses)
        refMap.put(ref,getXmlType(ref));

    // check for collision between "additional" ones and the ones given to JAXB
    // and eliminate duplication
    Iterator<Map.Entry<QName, Reference>> itr = additionalElementDecls.entrySet().iterator();
    while(itr.hasNext()) {
        Map.Entry<QName, Reference> entry = itr.next();
        if(entry.getValue()==null)      continue;

        NonElement<TypeMirror, TypeElement> xt = getXmlType(entry.getValue());

        assert xt!=null;
        refMap.put(entry.getValue(),xt);
        if(xt instanceof ClassInfo) {
            ClassInfo<TypeMirror, TypeElement> xct = (ClassInfo<TypeMirror, TypeElement>) xt;
            Element<TypeMirror, TypeElement> elem = xct.asElement();
            if(elem!=null && elem.getElementName().equals(entry.getKey())) {
                itr.remove();
                continue;
            }
        }
        ElementInfo<TypeMirror, TypeElement> ei = types.getElementInfo(null, entry.getKey());
        if(ei!=null && ei.getContentType()==xt)
            itr.remove();
    }
}