com.sun.xml.internal.bind.v2.model.nav.Navigator Java Examples

The following examples show how to use com.sun.xml.internal.bind.v2.model.nav.Navigator. 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: Adapter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public Adapter(ClassDeclT adapterType,Navigator<TypeT,ClassDeclT,?,?> nav) {
    this.adapterType = adapterType;
    TypeT baseClass = nav.getBaseClass(nav.use(adapterType), nav.asDecl(XmlAdapter.class));

    // because the parameterization of XmlJavaTypeAdapter requires that the class derives from XmlAdapter.
    assert baseClass!=null;

    if(nav.isParameterizedType(baseClass))
        defaultType = nav.getTypeArgument(baseClass,0);
    else
        defaultType = nav.ref(Object.class);

    if(nav.isParameterizedType(baseClass))
        customType = nav.getTypeArgument(baseClass,1);
    else
        customType = nav.ref(Object.class);
}
 
Example #2
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 #3
Source File: TypeInfoSetImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public TypeInfoSetImpl(Navigator<T,C,F,M> nav,
                       AnnotationReader<T,C,F,M> reader,
                       Map<T,? extends BuiltinLeafInfoImpl<T,C>> leaves) {
    this.nav = nav;
    this.reader = reader;
    this.builtins.putAll(leaves);

    this.anyType = createAnyType();

    // register primitive types.
    for (Map.Entry<Class, Class> e : RuntimeUtil.primitiveToBox.entrySet()) {
        this.builtins.put( nav.getPrimitive(e.getKey()), leaves.get(nav.ref(e.getValue())) );
    }

    // make sure at lease we got a map for global ones.
    elementMappings.put(null,new LinkedHashMap<QName,ElementInfoImpl<T,C,F,M>>());
}
 
Example #4
Source File: Adapter.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public Adapter(ClassDeclT adapterType,Navigator<TypeT,ClassDeclT,?,?> nav) {
    this.adapterType = adapterType;
    TypeT baseClass = nav.getBaseClass(nav.use(adapterType), nav.asDecl(XmlAdapter.class));

    // because the parameterization of XmlJavaTypeAdapter requires that the class derives from XmlAdapter.
    assert baseClass!=null;

    if(nav.isParameterizedType(baseClass))
        defaultType = nav.getTypeArgument(baseClass,0);
    else
        defaultType = nav.ref(Object.class);

    if(nav.isParameterizedType(baseClass))
        customType = nav.getTypeArgument(baseClass,1);
    else
        customType = nav.ref(Object.class);
}
 
Example #5
Source File: TypeInfoSetImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public TypeInfoSetImpl(Navigator<T,C,F,M> nav,
                       AnnotationReader<T,C,F,M> reader,
                       Map<T,? extends BuiltinLeafInfoImpl<T,C>> leaves) {
    this.nav = nav;
    this.reader = reader;
    this.builtins.putAll(leaves);

    this.anyType = createAnyType();

    // register primitive types.
    for (Map.Entry<Class, Class> e : RuntimeUtil.primitiveToBox.entrySet()) {
        this.builtins.put( nav.getPrimitive(e.getKey()), leaves.get(nav.ref(e.getValue())) );
    }

    // make sure at lease we got a map for global ones.
    elementMappings.put(null,new LinkedHashMap<QName,ElementInfoImpl<T,C,F,M>>());
}
 
Example #6
Source File: TypeInfoSetImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public TypeInfoSetImpl(Navigator<T,C,F,M> nav,
                       AnnotationReader<T,C,F,M> reader,
                       Map<T,? extends BuiltinLeafInfoImpl<T,C>> leaves) {
    this.nav = nav;
    this.reader = reader;
    this.builtins.putAll(leaves);

    this.anyType = createAnyType();

    // register primitive types.
    for (Map.Entry<Class, Class> e : RuntimeUtil.primitiveToBox.entrySet()) {
        this.builtins.put( nav.getPrimitive(e.getKey()), leaves.get(nav.ref(e.getValue())) );
    }

    // make sure at lease we got a map for global ones.
    elementMappings.put(null,new LinkedHashMap<QName,ElementInfoImpl<T,C,F,M>>());
}
 
Example #7
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 #8
Source File: ModelBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public ModelBuilder(
        AnnotationReader<T, C, F, M> reader,
        Navigator<T, C, F, M> navigator,
        Map<C, C> subclassReplacements,
        String defaultNamespaceRemap
) {

    this.reader = reader;
    this.nav = navigator;
    this.subclassReplacements = subclassReplacements;
    if(defaultNamespaceRemap==null)
        defaultNamespaceRemap = "";
    this.defaultNsUri = defaultNamespaceRemap;
    reader.setErrorHandler(proxyErrorHandler);
    typeInfoSet = createTypeInfoSet();
}
 
Example #9
Source File: ModelBuilder.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public ModelBuilder(
        AnnotationReader<T, C, F, M> reader,
        Navigator<T, C, F, M> navigator,
        Map<C, C> subclassReplacements,
        String defaultNamespaceRemap
) {

    this.reader = reader;
    this.nav = navigator;
    this.subclassReplacements = subclassReplacements;
    if(defaultNamespaceRemap==null)
        defaultNamespaceRemap = "";
    this.defaultNsUri = defaultNamespaceRemap;
    reader.setErrorHandler(proxyErrorHandler);
    typeInfoSet = createTypeInfoSet();
}
 
Example #10
Source File: Adapter.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public Adapter(ClassDeclT adapterType,Navigator<TypeT,ClassDeclT,?,?> nav) {
    this.adapterType = adapterType;
    TypeT baseClass = nav.getBaseClass(nav.use(adapterType), nav.asDecl(XmlAdapter.class));

    // because the parameterization of XmlJavaTypeAdapter requires that the class derives from XmlAdapter.
    assert baseClass!=null;

    if(nav.isParameterizedType(baseClass))
        defaultType = nav.getTypeArgument(baseClass,0);
    else
        defaultType = nav.ref(Object.class);

    if(nav.isParameterizedType(baseClass))
        customType = nav.getTypeArgument(baseClass,1);
    else
        customType = nav.ref(Object.class);
}
 
Example #11
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 #12
Source File: Adapter.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public Adapter(ClassDeclT adapterType,Navigator<TypeT,ClassDeclT,?,?> nav) {
    this.adapterType = adapterType;
    TypeT baseClass = nav.getBaseClass(nav.use(adapterType), nav.asDecl(XmlAdapter.class));

    // because the parameterization of XmlJavaTypeAdapter requires that the class derives from XmlAdapter.
    assert baseClass!=null;

    if(nav.isParameterizedType(baseClass))
        defaultType = nav.getTypeArgument(baseClass,0);
    else
        defaultType = nav.ref(Object.class);

    if(nav.isParameterizedType(baseClass))
        customType = nav.getTypeArgument(baseClass,1);
    else
        customType = nav.ref(Object.class);
}
 
Example #13
Source File: Adapter.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public Adapter(ClassDeclT adapterType,Navigator<TypeT,ClassDeclT,?,?> nav) {
    this.adapterType = adapterType;
    TypeT baseClass = nav.getBaseClass(nav.use(adapterType), nav.asDecl(XmlAdapter.class));

    // because the parameterization of XmlJavaTypeAdapter requires that the class derives from XmlAdapter.
    assert baseClass!=null;

    if(nav.isParameterizedType(baseClass))
        defaultType = nav.getTypeArgument(baseClass,0);
    else
        defaultType = nav.ref(Object.class);

    if(nav.isParameterizedType(baseClass))
        customType = nav.getTypeArgument(baseClass,1);
    else
        customType = nav.ref(Object.class);
}
 
Example #14
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 #15
Source File: BuiltinLeafInfoImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates all the {@link BuiltinLeafInfoImpl}s as specified in the spec.
 *
 * {@link LeafInfo}s are all defined by the spec.
 */
public static <TypeT,ClassDeclT>
Map<TypeT,BuiltinLeafInfoImpl<TypeT,ClassDeclT>> createLeaves( Navigator<TypeT,ClassDeclT,?,?> nav ) {
    Map<TypeT,BuiltinLeafInfoImpl<TypeT,ClassDeclT>> leaves = new HashMap<TypeT,BuiltinLeafInfoImpl<TypeT,ClassDeclT>>();

    for( RuntimeBuiltinLeafInfoImpl<?> leaf : RuntimeBuiltinLeafInfoImpl.builtinBeanInfos ) {
        TypeT t = nav.ref(leaf.getClazz());
        leaves.put( t, new BuiltinLeafInfoImpl<TypeT,ClassDeclT>(t,leaf.getTypeNames()) );
    }

    return leaves;
}
 
Example #16
Source File: Ref.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Ref(AnnotationReader<T,C,?,?> reader,
           Navigator<T,C,?,?> nav,
           T type, XmlJavaTypeAdapter xjta, XmlList xl ) {
    Adapter<T,C> adapter=null;
    if(xjta!=null) {
        adapter = new Adapter<T,C>(xjta,reader,nav);
        type = adapter.defaultType;
    }

    this.type = type;
    this.adapter = adapter;
    this.valueList = xl!=null;
}
 
Example #17
Source File: Adapter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Adapter(
    XmlJavaTypeAdapter spec,
    AnnotationReader<TypeT,ClassDeclT,?,?> reader,
    Navigator<TypeT,ClassDeclT,?,?> nav) {

    this( nav.asDecl(reader.getClassValue(spec,"value")), nav );
}
 
Example #18
Source File: Ref.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public Ref(AnnotationReader<T,C,?,?> reader,
           Navigator<T,C,?,?> nav,
           T type, XmlJavaTypeAdapter xjta, XmlList xl ) {
    Adapter<T,C> adapter=null;
    if(xjta!=null) {
        adapter = new Adapter<T,C>(xjta,reader,nav);
        type = adapter.defaultType;
    }

    this.type = type;
    this.adapter = adapter;
    this.valueList = xl!=null;
}
 
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-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 #21
Source File: Adapter.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public Adapter(
    XmlJavaTypeAdapter spec,
    AnnotationReader<TypeT,ClassDeclT,?,?> reader,
    Navigator<TypeT,ClassDeclT,?,?> nav) {

    this( nav.asDecl(reader.getClassValue(spec,"value")), nav );
}
 
Example #22
Source File: Ref.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public Ref(AnnotationReader<T,C,?,?> reader,
           Navigator<T,C,?,?> nav,
           T type, XmlJavaTypeAdapter xjta, XmlList xl ) {
    Adapter<T,C> adapter=null;
    if(xjta!=null) {
        adapter = new Adapter<T,C>(xjta,reader,nav);
        type = adapter.defaultType;
    }

    this.type = type;
    this.adapter = adapter;
    this.valueList = xl!=null;
}
 
Example #23
Source File: Ref.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public Ref(AnnotationReader<T,C,?,?> reader,
           Navigator<T,C,?,?> nav,
           T type, XmlJavaTypeAdapter xjta, XmlList xl ) {
    Adapter<T,C> adapter=null;
    if(xjta!=null) {
        adapter = new Adapter<T,C>(xjta,reader,nav);
        type = adapter.defaultType;
    }

    this.type = type;
    this.adapter = adapter;
    this.valueList = xl!=null;
}
 
Example #24
Source File: BuiltinLeafInfoImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates all the {@link BuiltinLeafInfoImpl}s as specified in the spec.
 *
 * {@link LeafInfo}s are all defined by the spec.
 */
public static <TypeT,ClassDeclT>
Map<TypeT,BuiltinLeafInfoImpl<TypeT,ClassDeclT>> createLeaves( Navigator<TypeT,ClassDeclT,?,?> nav ) {
    Map<TypeT,BuiltinLeafInfoImpl<TypeT,ClassDeclT>> leaves = new HashMap<TypeT,BuiltinLeafInfoImpl<TypeT,ClassDeclT>>();

    for( RuntimeBuiltinLeafInfoImpl<?> leaf : RuntimeBuiltinLeafInfoImpl.builtinBeanInfos ) {
        TypeT t = nav.ref(leaf.getClazz());
        leaves.put( t, new BuiltinLeafInfoImpl<TypeT,ClassDeclT>(t,leaf.getTypeNames()) );
    }

    return leaves;
}
 
Example #25
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 #26
Source File: AnyTypeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public AnyTypeImpl(Navigator<T,C,?,?> nav) {
    this.type = nav.ref(Object.class);
    this.nav = nav;
}
 
Example #27
Source File: PropertyInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected final Navigator<T,C,F,M> nav() {
    return parent.nav();
}
 
Example #28
Source File: TypeInfoSetImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public Navigator<T,C,F,M> getNavigator() {
    return nav;
}
 
Example #29
Source File: MethodLocatable.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public MethodLocatable(Locatable upstream, M method, Navigator<?,?,?,M> nav) {
    this.upstream = upstream;
    this.method = method;
    this.nav = nav;
}
 
Example #30
Source File: ClassLocatable.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public ClassLocatable(Locatable upstream, C clazz, Navigator<?,C,?,?> nav) {
    this.upstream = upstream;
    this.clazz = clazz;
    this.nav = nav;
}