Java Code Examples for com.sun.xml.internal.bind.v2.util.QNameMap

The following examples show how to use com.sun.xml.internal.bind.v2.util.QNameMap. These examples are extracted from open source projects. 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
public void createBodyUnmarshaller(UnmarshallerChain chain, QNameMap<ChildLoader> loaders) {
    final int offset = chain.allocateOffset();

    Receiver recv = new ReceiverImpl(offset);

    for( QNameMap.Entry<JaxBeanInfo> n : expectedElements.entrySet() ) {
        final JaxBeanInfo beanInfo = n.getValue();
        loaders.put(n.nsUri,n.localName,new ChildLoader(beanInfo.getLoader(chain.context,true),recv));
    }

    if(isMixed) {
        // handler for processing mixed contents.
        loaders.put(TEXT_HANDLER,
            new ChildLoader(new MixedTextLoader(recv),null));
    }

    if(domHandler!=null) {
        loaders.put(CATCH_ALL,
            new ChildLoader(new WildcardLoader(domHandler,wcMode),recv));
    }
}
 
Example 2
public void createBodyUnmarshaller(UnmarshallerChain chain, QNameMap<ChildLoader> loaders) {
    final int offset = chain.allocateOffset();

    Receiver recv = new ReceiverImpl(offset);

    for( QNameMap.Entry<JaxBeanInfo> n : expectedElements.entrySet() ) {
        final JaxBeanInfo beanInfo = n.getValue();
        loaders.put(n.nsUri,n.localName,new ChildLoader(beanInfo.getLoader(chain.context,true),recv));
    }

    if(isMixed) {
        // handler for processing mixed contents.
        loaders.put(TEXT_HANDLER,
            new ChildLoader(new MixedTextLoader(recv),null));
    }

    if(domHandler!=null) {
        loaders.put(CATCH_ALL,
            new ChildLoader(new WildcardLoader(domHandler,wcMode),recv));
    }
}
 
Example 3
public void createBodyUnmarshaller(UnmarshallerChain chain, QNameMap<ChildLoader> loaders) {
    final int offset = chain.allocateOffset();

    Receiver recv = new ReceiverImpl(offset);

    for( QNameMap.Entry<JaxBeanInfo> n : expectedElements.entrySet() ) {
        final JaxBeanInfo beanInfo = n.getValue();
        loaders.put(n.nsUri,n.localName,new ChildLoader(beanInfo.getLoader(chain.context,true),recv));
    }

    if(isMixed) {
        // handler for processing mixed contents.
        loaders.put(TEXT_HANDLER,
            new ChildLoader(new MixedTextLoader(recv),null));
    }

    if(domHandler!=null) {
        loaders.put(CATCH_ALL,
            new ChildLoader(new WildcardLoader(domHandler,wcMode),recv));
    }
}
 
Example 4
public void createBodyUnmarshaller(UnmarshallerChain chain, QNameMap<ChildLoader> loaders) {
    final int offset = chain.allocateOffset();

    Receiver recv = new ReceiverImpl(offset);

    for( QNameMap.Entry<JaxBeanInfo> n : expectedElements.entrySet() ) {
        final JaxBeanInfo beanInfo = n.getValue();
        loaders.put(n.nsUri,n.localName,new ChildLoader(beanInfo.getLoader(chain.context,true),recv));
    }

    if(isMixed) {
        // handler for processing mixed contents.
        loaders.put(TEXT_HANDLER,
            new ChildLoader(new MixedTextLoader(recv),null));
    }

    if(domHandler!=null) {
        loaders.put(CATCH_ALL,
            new ChildLoader(new WildcardLoader(domHandler,wcMode),recv));
    }
}
 
Example 5
public void createBodyUnmarshaller(UnmarshallerChain chain, QNameMap<ChildLoader> loaders) {
    final int offset = chain.allocateOffset();

    Receiver recv = new ReceiverImpl(offset);

    for( QNameMap.Entry<JaxBeanInfo> n : expectedElements.entrySet() ) {
        final JaxBeanInfo beanInfo = n.getValue();
        loaders.put(n.nsUri,n.localName,new ChildLoader(beanInfo.getLoader(chain.context,true),recv));
    }

    if(isMixed) {
        // handler for processing mixed contents.
        loaders.put(TEXT_HANDLER,
            new ChildLoader(new MixedTextLoader(recv),null));
    }

    if(domHandler!=null) {
        loaders.put(CATCH_ALL,
            new ChildLoader(new WildcardLoader(domHandler,wcMode),recv));
    }
}
 
Example 6
public void createBodyUnmarshaller(UnmarshallerChain chain, QNameMap<ChildLoader> loaders) {
    final int offset = chain.allocateOffset();

    Receiver recv = new ReceiverImpl(offset);

    for( QNameMap.Entry<JaxBeanInfo> n : expectedElements.entrySet() ) {
        final JaxBeanInfo beanInfo = n.getValue();
        loaders.put(n.nsUri,n.localName,new ChildLoader(beanInfo.getLoader(chain.context,true),recv));
    }

    if(isMixed) {
        // handler for processing mixed contents.
        loaders.put(TEXT_HANDLER,
            new ChildLoader(new MixedTextLoader(recv),null));
    }

    if(domHandler!=null) {
        loaders.put(CATCH_ALL,
            new ChildLoader(new WildcardLoader(domHandler,wcMode),recv));
    }
}
 
Example 7
public void createBodyUnmarshaller(UnmarshallerChain chain, QNameMap<ChildLoader> loaders) {
    final int offset = chain.allocateOffset();

    Receiver recv = new ReceiverImpl(offset);

    for( QNameMap.Entry<JaxBeanInfo> n : expectedElements.entrySet() ) {
        final JaxBeanInfo beanInfo = n.getValue();
        loaders.put(n.nsUri,n.localName,new ChildLoader(beanInfo.getLoader(chain.context,true),recv));
    }

    if(isMixed) {
        // handler for processing mixed contents.
        loaders.put(TEXT_HANDLER,
            new ChildLoader(new MixedTextLoader(recv),null));
    }

    if(domHandler!=null) {
        loaders.put(CATCH_ALL,
            new ChildLoader(new WildcardLoader(domHandler,wcMode),recv));
    }
}
 
Example 8
public void createBodyUnmarshaller(UnmarshallerChain chain, QNameMap<ChildLoader> loaders) {
    final int offset = chain.allocateOffset();

    Receiver recv = new ReceiverImpl(offset);

    for( QNameMap.Entry<JaxBeanInfo> n : expectedElements.entrySet() ) {
        final JaxBeanInfo beanInfo = n.getValue();
        loaders.put(n.nsUri,n.localName,new ChildLoader(beanInfo.getLoader(chain.context,true),recv));
    }

    if(isMixed) {
        // handler for processing mixed contents.
        loaders.put(TEXT_HANDLER,
            new ChildLoader(new MixedTextLoader(recv),null));
    }

    if(domHandler!=null) {
        loaders.put(CATCH_ALL,
            new ChildLoader(new WildcardLoader(domHandler,wcMode),recv));
    }
}
 
Example 9
public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> handlers) {
    for (QNameMap.Entry<JaxBeanInfo> n : expectedElements.entrySet())
        handlers.put(n.nsUri,n.localName, new ChildLoader(n.getValue().getLoader(chain.context,true),acc));

    if(domHandler!=null)
        handlers.put(CATCH_ALL,new ChildLoader(new WildcardLoader(domHandler,wcMode),acc));

}
 
Example 10
public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> handlers) {
    for (QNameMap.Entry<JaxBeanInfo> n : expectedElements.entrySet())
        handlers.put(n.nsUri,n.localName, new ChildLoader(n.getValue().getLoader(chain.context,true),acc));

    if(domHandler!=null)
        handlers.put(CATCH_ALL,new ChildLoader(new WildcardLoader(domHandler,wcMode),acc));

}
 
Example 11
Source Project: TencentKona-8   Source File: NameBuilder.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Name createName(String nsUri, String localName, boolean isAttribute, QNameMap<Integer> map) {
    assert nsUri.intern()==nsUri;
    assert localName.intern()==localName;

    return new Name(
            allocIndex(map,nsUri,localName),
            allocIndex(uriIndexMap,nsUri),
            nsUri,
            allocIndex(localNameIndexMap,localName),
            localName,
            isAttribute );
}
 
Example 12
Source Project: TencentKona-8   Source File: NameBuilder.java    License: GNU General Public License v2.0 5 votes vote down vote up
private int allocIndex(QNameMap<Integer> map, String nsUri, String localName) {
    Integer i = map.get(nsUri,localName);
    if(i==null) {
        i = map.size();
        map.put(nsUri,localName,i);
    }
    return i;
}
 
Example 13
/**
 * Returns the set of valid root tag names.
 * For diagnostic use.
 */
public Set<QName> getValidRootNames() {
    Set<QName> r = new TreeSet<QName>(QNAME_COMPARATOR);
    for (QNameMap.Entry e : rootMap.entrySet()) {
        r.add(e.createQName());
    }
    return r;
}
 
Example 14
public Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable) {
    if(loader==null) {
        // this has to be done lazily to avoid cyclic reference issue
        UnmarshallerChain c = new UnmarshallerChain(context);
        QNameMap<ChildLoader> result = new QNameMap<ChildLoader>();
        property.buildChildElementUnmarshallers(c,result);
        if(result.size()==1)
            // for ElementBeanInfoImpl created from RuntimeElementInfo
            this.loader = new IntercepterLoader(result.getOne().getValue().loader);
        else
            // for special ElementBeanInfoImpl only used for marshalling
            this.loader = Discarder.INSTANCE;
    }
    return loader;
}
 
Example 15
public Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable) {
    if(loader==null) {
        // this has to be done lazily to avoid cyclic reference issue
        UnmarshallerChain c = new UnmarshallerChain(context);
        QNameMap<ChildLoader> result = new QNameMap<ChildLoader>();
        property.buildChildElementUnmarshallers(c,result);
        if(result.size()==1)
            // for ElementBeanInfoImpl created from RuntimeElementInfo
            this.loader = new IntercepterLoader(result.getOne().getValue().loader);
        else
            // for special ElementBeanInfoImpl only used for marshalling
            this.loader = Discarder.INSTANCE;
    }
    return loader;
}
 
Example 16
public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> handlers) {
    for (QNameMap.Entry<JaxBeanInfo> n : expectedElements.entrySet())
        handlers.put(n.nsUri,n.localName, new ChildLoader(n.getValue().getLoader(chain.context,true),acc));

    if(domHandler!=null)
        handlers.put(CATCH_ALL,new ChildLoader(new WildcardLoader(domHandler,wcMode),acc));

}
 
Example 17
Source Project: jdk8u60   Source File: NameBuilder.java    License: GNU General Public License v2.0 5 votes vote down vote up
private int allocIndex(QNameMap<Integer> map, String nsUri, String localName) {
    Integer i = map.get(nsUri,localName);
    if(i==null) {
        i = map.size();
        map.put(nsUri,localName,i);
    }
    return i;
}
 
Example 18
Source Project: jdk8u60   Source File: ElementBeanInfoImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
public Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable) {
    if(loader==null) {
        // this has to be done lazily to avoid cyclic reference issue
        UnmarshallerChain c = new UnmarshallerChain(context);
        QNameMap<ChildLoader> result = new QNameMap<ChildLoader>();
        property.buildChildElementUnmarshallers(c,result);
        if(result.size()==1)
            // for ElementBeanInfoImpl created from RuntimeElementInfo
            this.loader = new IntercepterLoader(result.getOne().getValue().loader);
        else
            // for special ElementBeanInfoImpl only used for marshalling
            this.loader = Discarder.INSTANCE;
    }
    return loader;
}
 
Example 19
Source Project: jdk8u60   Source File: StructureLoader.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Completes the initialization.
 *
 * <p>
 * To fix the cyclic reference issue, the main part of the initialization needs to be done
 * after a {@link StructureLoader} is set to {@link ClassBeanInfoImpl#loader}.
 */
public void init( JAXBContextImpl context, ClassBeanInfoImpl beanInfo, Accessor<?,Map<QName,String>> attWildcard) {
    UnmarshallerChain chain = new UnmarshallerChain(context);
    for (ClassBeanInfoImpl bi = beanInfo; bi != null; bi = bi.superClazz) {
        for (int i = bi.properties.length - 1; i >= 0; i--) {
            Property p = bi.properties[i];

            switch(p.getKind()) {
            case ATTRIBUTE:
                if(attUnmarshallers==null)
                    attUnmarshallers = new QNameMap<TransducedAccessor>();
                AttributeProperty ap = (AttributeProperty) p;
                attUnmarshallers.put(ap.attName.toQName(),ap.xacc);
                break;
            case ELEMENT:
            case REFERENCE:
            case MAP:
            case VALUE:
                p.buildChildElementUnmarshallers(chain,childUnmarshallers);
                break;
            }
        }
    }

    this.frameSize = chain.getScopeSize();

    textHandler = childUnmarshallers.get(StructureLoaderBuilder.TEXT_HANDLER);
    catchAll = childUnmarshallers.get(StructureLoaderBuilder.CATCH_ALL);

    if(attWildcard!=null) {
        attCatchAll = (Accessor<Object,Map<QName,String>>) attWildcard;
        // we use attUnmarshallers==null as a sign to skip the attribute processing
        // altogether, so if we have an att wildcard we need to have an empty qname map.
        if(attUnmarshallers==null)
            attUnmarshallers = EMPTY;
    } else {
        attCatchAll = null;
    }
}
 
Example 20
Source Project: openjdk-8   Source File: NameBuilder.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Name createName(String nsUri, String localName, boolean isAttribute, QNameMap<Integer> map) {
    assert nsUri.intern()==nsUri;
    assert localName.intern()==localName;

    return new Name(
            allocIndex(map,nsUri,localName),
            allocIndex(uriIndexMap,nsUri),
            nsUri,
            allocIndex(localNameIndexMap,localName),
            localName,
            isAttribute );
}
 
Example 21
public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> handlers) {
    for (QNameMap.Entry<JaxBeanInfo> n : expectedElements.entrySet())
        handlers.put(n.nsUri,n.localName, new ChildLoader(n.getValue().getLoader(chain.context,true),acc));

    if(domHandler!=null)
        handlers.put(CATCH_ALL,new ChildLoader(new WildcardLoader(domHandler,wcMode),acc));

}
 
Example 22
Source Project: openjdk-jdk8u   Source File: NameBuilder.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Name createName(String nsUri, String localName, boolean isAttribute, QNameMap<Integer> map) {
    assert nsUri.intern()==nsUri;
    assert localName.intern()==localName;

    return new Name(
            allocIndex(map,nsUri,localName),
            allocIndex(uriIndexMap,nsUri),
            nsUri,
            allocIndex(localNameIndexMap,localName),
            localName,
            isAttribute );
}
 
Example 23
/**
 * Returns the set of valid root tag names.
 * For diagnostic use.
 */
public Set<QName> getValidRootNames() {
    Set<QName> r = new TreeSet<QName>(QNAME_COMPARATOR);
    for (QNameMap.Entry e : rootMap.entrySet()) {
        r.add(e.createQName());
    }
    return r;
}
 
Example 24
public Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable) {
    if(loader==null) {
        // this has to be done lazily to avoid cyclic reference issue
        UnmarshallerChain c = new UnmarshallerChain(context);
        QNameMap<ChildLoader> result = new QNameMap<ChildLoader>();
        property.buildChildElementUnmarshallers(c,result);
        if(result.size()==1)
            // for ElementBeanInfoImpl created from RuntimeElementInfo
            this.loader = new IntercepterLoader(result.getOne().getValue().loader);
        else
            // for special ElementBeanInfoImpl only used for marshalling
            this.loader = Discarder.INSTANCE;
    }
    return loader;
}
 
Example 25
/**
 * Completes the initialization.
 *
 * <p>
 * To fix the cyclic reference issue, the main part of the initialization needs to be done
 * after a {@link StructureLoader} is set to {@link ClassBeanInfoImpl#loader}.
 */
public void init( JAXBContextImpl context, ClassBeanInfoImpl beanInfo, Accessor<?,Map<QName,String>> attWildcard) {
    UnmarshallerChain chain = new UnmarshallerChain(context);
    for (ClassBeanInfoImpl bi = beanInfo; bi != null; bi = bi.superClazz) {
        for (int i = bi.properties.length - 1; i >= 0; i--) {
            Property p = bi.properties[i];

            switch(p.getKind()) {
            case ATTRIBUTE:
                if(attUnmarshallers==null)
                    attUnmarshallers = new QNameMap<TransducedAccessor>();
                AttributeProperty ap = (AttributeProperty) p;
                attUnmarshallers.put(ap.attName.toQName(),ap.xacc);
                break;
            case ELEMENT:
            case REFERENCE:
            case MAP:
            case VALUE:
                p.buildChildElementUnmarshallers(chain,childUnmarshallers);
                break;
            }
        }
    }

    this.frameSize = chain.getScopeSize();

    textHandler = childUnmarshallers.get(StructureLoaderBuilder.TEXT_HANDLER);
    catchAll = childUnmarshallers.get(StructureLoaderBuilder.CATCH_ALL);

    if(attWildcard!=null) {
        attCatchAll = (Accessor<Object,Map<QName,String>>) attWildcard;
        // we use attUnmarshallers==null as a sign to skip the attribute processing
        // altogether, so if we have an att wildcard we need to have an empty qname map.
        if(attUnmarshallers==null)
            attUnmarshallers = EMPTY;
    } else {
        attCatchAll = null;
    }
}
 
Example 26
private Name createName(String nsUri, String localName, boolean isAttribute, QNameMap<Integer> map) {
    assert nsUri.intern()==nsUri;
    assert localName.intern()==localName;

    return new Name(
            allocIndex(map,nsUri,localName),
            allocIndex(uriIndexMap,nsUri),
            nsUri,
            allocIndex(localNameIndexMap,localName),
            localName,
            isAttribute );
}
 
Example 27
private int allocIndex(QNameMap<Integer> map, String nsUri, String localName) {
    Integer i = map.get(nsUri,localName);
    if(i==null) {
        i = map.size();
        map.put(nsUri,localName,i);
    }
    return i;
}
 
Example 28
/**
 * Returns the set of valid root tag names.
 * For diagnostic use.
 */
public Set<QName> getValidRootNames() {
    Set<QName> r = new TreeSet<QName>(QNAME_COMPARATOR);
    for (QNameMap.Entry e : rootMap.entrySet()) {
        r.add(e.createQName());
    }
    return r;
}
 
Example 29
public Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable) {
    if(loader==null) {
        // this has to be done lazily to avoid cyclic reference issue
        UnmarshallerChain c = new UnmarshallerChain(context);
        QNameMap<ChildLoader> result = new QNameMap<ChildLoader>();
        property.buildChildElementUnmarshallers(c,result);
        if(result.size()==1)
            // for ElementBeanInfoImpl created from RuntimeElementInfo
            this.loader = new IntercepterLoader(result.getOne().getValue().loader);
        else
            // for special ElementBeanInfoImpl only used for marshalling
            this.loader = Discarder.INSTANCE;
    }
    return loader;
}
 
Example 30
/**
 * Completes the initialization.
 *
 * <p>
 * To fix the cyclic reference issue, the main part of the initialization needs to be done
 * after a {@link StructureLoader} is set to {@link ClassBeanInfoImpl#loader}.
 */
public void init( JAXBContextImpl context, ClassBeanInfoImpl beanInfo, Accessor<?,Map<QName,String>> attWildcard) {
    UnmarshallerChain chain = new UnmarshallerChain(context);
    for (ClassBeanInfoImpl bi = beanInfo; bi != null; bi = bi.superClazz) {
        for (int i = bi.properties.length - 1; i >= 0; i--) {
            Property p = bi.properties[i];

            switch(p.getKind()) {
            case ATTRIBUTE:
                if(attUnmarshallers==null)
                    attUnmarshallers = new QNameMap<TransducedAccessor>();
                AttributeProperty ap = (AttributeProperty) p;
                attUnmarshallers.put(ap.attName.toQName(),ap.xacc);
                break;
            case ELEMENT:
            case REFERENCE:
            case MAP:
            case VALUE:
                p.buildChildElementUnmarshallers(chain,childUnmarshallers);
                break;
            }
        }
    }

    this.frameSize = chain.getScopeSize();

    textHandler = childUnmarshallers.get(StructureLoaderBuilder.TEXT_HANDLER);
    catchAll = childUnmarshallers.get(StructureLoaderBuilder.CATCH_ALL);

    if(attWildcard!=null) {
        attCatchAll = (Accessor<Object,Map<QName,String>>) attWildcard;
        // we use attUnmarshallers==null as a sign to skip the attribute processing
        // altogether, so if we have an att wildcard we need to have an empty qname map.
        if(attUnmarshallers==null)
            attUnmarshallers = EMPTY;
    } else {
        attCatchAll = null;
    }
}