Java Code Examples for com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl#getOrCreate()

The following examples show how to use com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl#getOrCreate() . 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: ArrayElementProperty.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected ArrayElementProperty(JAXBContextImpl grammar, RuntimeElementPropertyInfo prop) {
    super(grammar, prop, prop.getXmlName(), prop.isCollectionNillable());
    this.prop = prop;

    List<? extends RuntimeTypeRef> types = prop.getTypes();

    Name n = null;

    for (RuntimeTypeRef typeRef : types) {
        Class type = (Class)typeRef.getTarget().getType();
        if(type.isPrimitive())
            type = RuntimeUtil.primitiveToBox.get(type);

        JaxBeanInfo beanInfo = grammar.getOrCreate(typeRef.getTarget());
        TagAndType tt = new TagAndType(
                            grammar.nameBuilder.createElementName(typeRef.getTagName()),
                            beanInfo);
        typeMap.put(type,tt);
        refs.put(typeRef,beanInfo);
        if(typeRef.isNillable() && n==null)
            n = tt.tagName;
    }

    nillableTagName = n;
}
 
Example 2
Source File: ArrayReferenceNodeProperty.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public ArrayReferenceNodeProperty(JAXBContextImpl p, RuntimeReferencePropertyInfo prop) {
    super(p, prop, prop.getXmlName(), prop.isCollectionNillable());

    for (RuntimeElement e : prop.getElements()) {
        JaxBeanInfo bi = p.getOrCreate(e);
        expectedElements.put( e.getElementName().getNamespaceURI(),e.getElementName().getLocalPart(), bi );
    }

    isMixed = prop.isMixed();

    if(prop.getWildcard()!=null) {
        domHandler = (DomHandler) ClassFactory.create(prop.getDOMHandler());
        wcMode = prop.getWildcard();
    } else {
        domHandler = null;
        wcMode = null;
    }
}
 
Example 3
Source File: ArrayElementProperty.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected ArrayElementProperty(JAXBContextImpl grammar, RuntimeElementPropertyInfo prop) {
    super(grammar, prop, prop.getXmlName(), prop.isCollectionNillable());
    this.prop = prop;

    List<? extends RuntimeTypeRef> types = prop.getTypes();

    Name n = null;

    for (RuntimeTypeRef typeRef : types) {
        Class type = (Class)typeRef.getTarget().getType();
        if(type.isPrimitive())
            type = RuntimeUtil.primitiveToBox.get(type);

        JaxBeanInfo beanInfo = grammar.getOrCreate(typeRef.getTarget());
        TagAndType tt = new TagAndType(
                            grammar.nameBuilder.createElementName(typeRef.getTagName()),
                            beanInfo);
        typeMap.put(type,tt);
        refs.put(typeRef,beanInfo);
        if(typeRef.isNillable() && n==null)
            n = tt.tagName;
    }

    nillableTagName = n;
}
 
Example 4
Source File: SingleMapNodeProperty.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public SingleMapNodeProperty(JAXBContextImpl context, RuntimeMapPropertyInfo prop) {
    super(context, prop);
    acc = prop.getAccessor().optimize(context);
    this.tagName = context.nameBuilder.createElementName(prop.getXmlName());
    this.entryTag = context.nameBuilder.createElementName("","entry");
    this.keyTag = context.nameBuilder.createElementName("","key");
    this.valueTag = context.nameBuilder.createElementName("","value");
    this.nillable = prop.isCollectionNillable();
    this.keyBeanInfo = context.getOrCreate(prop.getKeyType());
    this.valueBeanInfo = context.getOrCreate(prop.getValueType());

    // infer the implementation class
    //noinspection unchecked
    Class<ValueT> sig = (Class<ValueT>) Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType());
    mapImplClass = ClassFactory.inferImplClass(sig,knownImplClasses);
    // TODO: error check for mapImplClass==null
    // what is the error reporting path for this part of the code?
}
 
Example 5
Source File: SingleElementNodeProperty.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public SingleElementNodeProperty(JAXBContextImpl context, RuntimeElementPropertyInfo prop) {
    super(context,prop);
    acc = prop.getAccessor().optimize(context);
    this.prop = prop;

    QName nt = null;
    boolean nil = false;

    acceptedElements = new QName[prop.getTypes().size()];
    for( int i=0; i<acceptedElements.length; i++ )
        acceptedElements[i] = prop.getTypes().get(i).getTagName();

    for (RuntimeTypeRef e : prop.getTypes()) {
        JaxBeanInfo beanInfo = context.getOrCreate(e.getTarget());
        if(nt==null)    nt = e.getTagName();
        typeNames.put( beanInfo.jaxbType, new TagAndType(
            context.nameBuilder.createElementName(e.getTagName()),beanInfo) );
        nil |= e.isNillable();
    }

    nullTagName = context.nameBuilder.createElementName(nt);

    nillable = nil;
}
 
Example 6
Source File: SingleElementNodeProperty.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public SingleElementNodeProperty(JAXBContextImpl context, RuntimeElementPropertyInfo prop) {
    super(context,prop);
    acc = prop.getAccessor().optimize(context);
    this.prop = prop;

    QName nt = null;
    boolean nil = false;

    acceptedElements = new QName[prop.getTypes().size()];
    for( int i=0; i<acceptedElements.length; i++ )
        acceptedElements[i] = prop.getTypes().get(i).getTagName();

    for (RuntimeTypeRef e : prop.getTypes()) {
        JaxBeanInfo beanInfo = context.getOrCreate(e.getTarget());
        if(nt==null)    nt = e.getTagName();
        typeNames.put( beanInfo.jaxbType, new TagAndType(
            context.nameBuilder.createElementName(e.getTagName()),beanInfo) );
        nil |= e.isNillable();
    }

    nullTagName = context.nameBuilder.createElementName(nt);

    nillable = nil;
}
 
Example 7
Source File: ArrayElementProperty.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
protected ArrayElementProperty(JAXBContextImpl grammar, RuntimeElementPropertyInfo prop) {
    super(grammar, prop, prop.getXmlName(), prop.isCollectionNillable());
    this.prop = prop;

    List<? extends RuntimeTypeRef> types = prop.getTypes();

    Name n = null;

    for (RuntimeTypeRef typeRef : types) {
        Class type = (Class)typeRef.getTarget().getType();
        if(type.isPrimitive())
            type = RuntimeUtil.primitiveToBox.get(type);

        JaxBeanInfo beanInfo = grammar.getOrCreate(typeRef.getTarget());
        TagAndType tt = new TagAndType(
                            grammar.nameBuilder.createElementName(typeRef.getTagName()),
                            beanInfo);
        typeMap.put(type,tt);
        refs.put(typeRef,beanInfo);
        if(typeRef.isNillable() && n==null)
            n = tt.tagName;
    }

    nillableTagName = n;
}
 
Example 8
Source File: SingleMapNodeProperty.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public SingleMapNodeProperty(JAXBContextImpl context, RuntimeMapPropertyInfo prop) {
    super(context, prop);
    acc = prop.getAccessor().optimize(context);
    this.tagName = context.nameBuilder.createElementName(prop.getXmlName());
    this.entryTag = context.nameBuilder.createElementName("","entry");
    this.keyTag = context.nameBuilder.createElementName("","key");
    this.valueTag = context.nameBuilder.createElementName("","value");
    this.nillable = prop.isCollectionNillable();
    this.keyBeanInfo = context.getOrCreate(prop.getKeyType());
    this.valueBeanInfo = context.getOrCreate(prop.getValueType());

    // infer the implementation class
    //noinspection unchecked
    Class<ValueT> sig = (Class<ValueT>) Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType());
    mapImplClass = ClassFactory.inferImplClass(sig,knownImplClasses);
    // TODO: error check for mapImplClass==null
    // what is the error reporting path for this part of the code?
}
 
Example 9
Source File: SingleElementNodeProperty.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public SingleElementNodeProperty(JAXBContextImpl context, RuntimeElementPropertyInfo prop) {
    super(context,prop);
    acc = prop.getAccessor().optimize(context);
    this.prop = prop;

    QName nt = null;
    boolean nil = false;

    acceptedElements = new QName[prop.getTypes().size()];
    for( int i=0; i<acceptedElements.length; i++ )
        acceptedElements[i] = prop.getTypes().get(i).getTagName();

    for (RuntimeTypeRef e : prop.getTypes()) {
        JaxBeanInfo beanInfo = context.getOrCreate(e.getTarget());
        if(nt==null)    nt = e.getTagName();
        typeNames.put( beanInfo.jaxbType, new TagAndType(
            context.nameBuilder.createElementName(e.getTagName()),beanInfo) );
        nil |= e.isNillable();
    }

    nullTagName = context.nameBuilder.createElementName(nt);

    nillable = nil;
}
 
Example 10
Source File: SingleMapNodeProperty.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public SingleMapNodeProperty(JAXBContextImpl context, RuntimeMapPropertyInfo prop) {
    super(context, prop);
    acc = prop.getAccessor().optimize(context);
    this.tagName = context.nameBuilder.createElementName(prop.getXmlName());
    this.entryTag = context.nameBuilder.createElementName("","entry");
    this.keyTag = context.nameBuilder.createElementName("","key");
    this.valueTag = context.nameBuilder.createElementName("","value");
    this.nillable = prop.isCollectionNillable();
    this.keyBeanInfo = context.getOrCreate(prop.getKeyType());
    this.valueBeanInfo = context.getOrCreate(prop.getValueType());

    // infer the implementation class
    //noinspection unchecked
    Class<ValueT> sig = (Class<ValueT>) Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType());
    mapImplClass = ClassFactory.inferImplClass(sig,knownImplClasses);
    // TODO: error check for mapImplClass==null
    // what is the error reporting path for this part of the code?
}
 
Example 11
Source File: ArrayElementProperty.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
protected ArrayElementProperty(JAXBContextImpl grammar, RuntimeElementPropertyInfo prop) {
    super(grammar, prop, prop.getXmlName(), prop.isCollectionNillable());
    this.prop = prop;

    List<? extends RuntimeTypeRef> types = prop.getTypes();

    Name n = null;

    for (RuntimeTypeRef typeRef : types) {
        Class type = (Class)typeRef.getTarget().getType();
        if(type.isPrimitive())
            type = RuntimeUtil.primitiveToBox.get(type);

        JaxBeanInfo beanInfo = grammar.getOrCreate(typeRef.getTarget());
        TagAndType tt = new TagAndType(
                            grammar.nameBuilder.createElementName(typeRef.getTagName()),
                            beanInfo);
        typeMap.put(type,tt);
        refs.put(typeRef,beanInfo);
        if(typeRef.isNillable() && n==null)
            n = tt.tagName;
    }

    nillableTagName = n;
}
 
Example 12
Source File: SingleMapNodeProperty.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public SingleMapNodeProperty(JAXBContextImpl context, RuntimeMapPropertyInfo prop) {
    super(context, prop);
    acc = prop.getAccessor().optimize(context);
    this.tagName = context.nameBuilder.createElementName(prop.getXmlName());
    this.entryTag = context.nameBuilder.createElementName("","entry");
    this.keyTag = context.nameBuilder.createElementName("","key");
    this.valueTag = context.nameBuilder.createElementName("","value");
    this.nillable = prop.isCollectionNillable();
    this.keyBeanInfo = context.getOrCreate(prop.getKeyType());
    this.valueBeanInfo = context.getOrCreate(prop.getValueType());

    // infer the implementation class
    //noinspection unchecked
    Class<ValueT> sig = (Class<ValueT>) Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType());
    mapImplClass = ClassFactory.inferImplClass(sig,knownImplClasses);
    // TODO: error check for mapImplClass==null
    // what is the error reporting path for this part of the code?
}
 
Example 13
Source File: SingleElementNodeProperty.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public SingleElementNodeProperty(JAXBContextImpl context, RuntimeElementPropertyInfo prop) {
    super(context,prop);
    acc = prop.getAccessor().optimize(context);
    this.prop = prop;

    QName nt = null;
    boolean nil = false;

    acceptedElements = new QName[prop.getTypes().size()];
    for( int i=0; i<acceptedElements.length; i++ )
        acceptedElements[i] = prop.getTypes().get(i).getTagName();

    for (RuntimeTypeRef e : prop.getTypes()) {
        JaxBeanInfo beanInfo = context.getOrCreate(e.getTarget());
        if(nt==null)    nt = e.getTagName();
        typeNames.put( beanInfo.jaxbType, new TagAndType(
            context.nameBuilder.createElementName(e.getTagName()),beanInfo) );
        nil |= e.isNillable();
    }

    nullTagName = context.nameBuilder.createElementName(nt);

    nillable = nil;
}
 
Example 14
Source File: ArrayElementProperty.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
protected ArrayElementProperty(JAXBContextImpl grammar, RuntimeElementPropertyInfo prop) {
    super(grammar, prop, prop.getXmlName(), prop.isCollectionNillable());
    this.prop = prop;

    List<? extends RuntimeTypeRef> types = prop.getTypes();

    Name n = null;

    for (RuntimeTypeRef typeRef : types) {
        Class type = (Class)typeRef.getTarget().getType();
        if(type.isPrimitive())
            type = RuntimeUtil.primitiveToBox.get(type);

        JaxBeanInfo beanInfo = grammar.getOrCreate(typeRef.getTarget());
        TagAndType tt = new TagAndType(
                            grammar.nameBuilder.createElementName(typeRef.getTagName()),
                            beanInfo);
        typeMap.put(type,tt);
        refs.put(typeRef,beanInfo);
        if(typeRef.isNillable() && n==null)
            n = tt.tagName;
    }

    nillableTagName = n;
}
 
Example 15
Source File: ArrayElementProperty.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected ArrayElementProperty(JAXBContextImpl grammar, RuntimeElementPropertyInfo prop) {
    super(grammar, prop, prop.getXmlName(), prop.isCollectionNillable());
    this.prop = prop;

    List<? extends RuntimeTypeRef> types = prop.getTypes();

    Name n = null;

    for (RuntimeTypeRef typeRef : types) {
        Class type = (Class)typeRef.getTarget().getType();
        if(type.isPrimitive())
            type = RuntimeUtil.primitiveToBox.get(type);

        JaxBeanInfo beanInfo = grammar.getOrCreate(typeRef.getTarget());
        TagAndType tt = new TagAndType(
                            grammar.nameBuilder.createElementName(typeRef.getTagName()),
                            beanInfo);
        typeMap.put(type,tt);
        refs.put(typeRef,beanInfo);
        if(typeRef.isNillable() && n==null)
            n = tt.tagName;
    }

    nillableTagName = n;
}
 
Example 16
Source File: SingleMapNodeProperty.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public SingleMapNodeProperty(JAXBContextImpl context, RuntimeMapPropertyInfo prop) {
    super(context, prop);
    acc = prop.getAccessor().optimize(context);
    this.tagName = context.nameBuilder.createElementName(prop.getXmlName());
    this.entryTag = context.nameBuilder.createElementName("","entry");
    this.keyTag = context.nameBuilder.createElementName("","key");
    this.valueTag = context.nameBuilder.createElementName("","value");
    this.nillable = prop.isCollectionNillable();
    this.keyBeanInfo = context.getOrCreate(prop.getKeyType());
    this.valueBeanInfo = context.getOrCreate(prop.getValueType());

    // infer the implementation class
    //noinspection unchecked
    Class<ValueT> sig = (Class<ValueT>) Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType());
    mapImplClass = ClassFactory.inferImplClass(sig,knownImplClasses);
    // TODO: error check for mapImplClass==null
    // what is the error reporting path for this part of the code?
}
 
Example 17
Source File: ArrayReferenceNodeProperty.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public ArrayReferenceNodeProperty(JAXBContextImpl p, RuntimeReferencePropertyInfo prop) {
    super(p, prop, prop.getXmlName(), prop.isCollectionNillable());

    for (RuntimeElement e : prop.getElements()) {
        JaxBeanInfo bi = p.getOrCreate(e);
        expectedElements.put( e.getElementName().getNamespaceURI(),e.getElementName().getLocalPart(), bi );
    }

    isMixed = prop.isMixed();

    if(prop.getWildcard()!=null) {
        domHandler = (DomHandler) ClassFactory.create(prop.getDOMHandler());
        wcMode = prop.getWildcard();
    } else {
        domHandler = null;
        wcMode = null;
    }
}
 
Example 18
Source File: ArrayReferenceNodeProperty.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public ArrayReferenceNodeProperty(JAXBContextImpl p, RuntimeReferencePropertyInfo prop) {
    super(p, prop, prop.getXmlName(), prop.isCollectionNillable());

    for (RuntimeElement e : prop.getElements()) {
        JaxBeanInfo bi = p.getOrCreate(e);
        expectedElements.put( e.getElementName().getNamespaceURI(),e.getElementName().getLocalPart(), bi );
    }

    isMixed = prop.isMixed();

    if(prop.getWildcard()!=null) {
        domHandler = (DomHandler) ClassFactory.create(prop.getDOMHandler());
        wcMode = prop.getWildcard();
    } else {
        domHandler = null;
        wcMode = null;
    }
}
 
Example 19
Source File: ArrayElementProperty.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected ArrayElementProperty(JAXBContextImpl grammar, RuntimeElementPropertyInfo prop) {
    super(grammar, prop, prop.getXmlName(), prop.isCollectionNillable());
    this.prop = prop;

    List<? extends RuntimeTypeRef> types = prop.getTypes();

    Name n = null;

    for (RuntimeTypeRef typeRef : types) {
        Class type = (Class)typeRef.getTarget().getType();
        if(type.isPrimitive())
            type = RuntimeUtil.primitiveToBox.get(type);

        JaxBeanInfo beanInfo = grammar.getOrCreate(typeRef.getTarget());
        TagAndType tt = new TagAndType(
                            grammar.nameBuilder.createElementName(typeRef.getTagName()),
                            beanInfo);
        typeMap.put(type,tt);
        refs.put(typeRef,beanInfo);
        if(typeRef.isNillable() && n==null)
            n = tt.tagName;
    }

    nillableTagName = n;
}
 
Example 20
Source File: SingleMapNodeProperty.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public SingleMapNodeProperty(JAXBContextImpl context, RuntimeMapPropertyInfo prop) {
    super(context, prop);
    acc = prop.getAccessor().optimize(context);
    this.tagName = context.nameBuilder.createElementName(prop.getXmlName());
    this.entryTag = context.nameBuilder.createElementName("","entry");
    this.keyTag = context.nameBuilder.createElementName("","key");
    this.valueTag = context.nameBuilder.createElementName("","value");
    this.nillable = prop.isCollectionNillable();
    this.keyBeanInfo = context.getOrCreate(prop.getKeyType());
    this.valueBeanInfo = context.getOrCreate(prop.getValueType());

    // infer the implementation class
    //noinspection unchecked
    Class<ValueT> sig = (Class<ValueT>) Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType());
    mapImplClass = ClassFactory.inferImplClass(sig,knownImplClasses);
    // TODO: error check for mapImplClass==null
    // what is the error reporting path for this part of the code?
}