com.sun.xml.internal.bind.v2.runtime.property.UnmarshallerChain Java Examples

The following examples show how to use com.sun.xml.internal.bind.v2.runtime.property.UnmarshallerChain. 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: ElementBeanInfoImpl.java    From TencentKona-8 with 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 #2
Source File: StructureLoader.java    From openjdk-8 with 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 #3
Source File: ElementBeanInfoImpl.java    From openjdk-8 with 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 #4
Source File: StructureLoader.java    From openjdk-8-source with 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 #5
Source File: ElementBeanInfoImpl.java    From openjdk-8-source with 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 #6
Source File: StructureLoader.java    From hottub with 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 #7
Source File: ElementBeanInfoImpl.java    From hottub with 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 #8
Source File: StructureLoader.java    From openjdk-jdk9 with 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 #9
Source File: ElementBeanInfoImpl.java    From openjdk-jdk9 with 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 #10
Source File: StructureLoader.java    From openjdk-jdk8u-backup with 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 #11
Source File: ElementBeanInfoImpl.java    From openjdk-jdk8u-backup with 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 #12
Source File: StructureLoader.java    From openjdk-jdk8u with 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 #13
Source File: ElementBeanInfoImpl.java    From openjdk-jdk8u with 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 #14
Source File: StructureLoader.java    From jdk8u60 with 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 #15
Source File: ElementBeanInfoImpl.java    From jdk8u60 with 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 #16
Source File: StructureLoader.java    From TencentKona-8 with 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 #17
Source File: ElementBeanInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The constructor for the sole instanceof {@link JaxBeanInfo} for
 * handling user-created {@link JAXBElement}.
 *
 * Such {@link JaxBeanInfo} is used only for marshalling.
 *
 * This is a hack.
 */
protected ElementBeanInfoImpl(final JAXBContextImpl grammar) {
    super(grammar,null,JAXBElement.class,true,false,true);
    tagName = null;
    expectedType = null;
    scope = null;
    constructor = null;

    this.property = new Property<JAXBElement>() {
        public void reset(JAXBElement o) {
            throw new UnsupportedOperationException();
        }

        public void serializeBody(JAXBElement e, XMLSerializer target, Object outerPeer) throws SAXException, IOException, XMLStreamException {
            Class scope = e.getScope();
            if(e.isGlobalScope())   scope = null;
            QName n = e.getName();
            ElementBeanInfoImpl bi = grammar.getElement(scope,n);
            if(bi==null) {
                // infer what to do from the type
                JaxBeanInfo tbi;
                try {
                    tbi = grammar.getBeanInfo(e.getDeclaredType(),true);
                } catch (JAXBException x) {
                    // if e.getDeclaredType() isn't known to this JAXBContext
                    target.reportError(null,x);
                    return;
                }
                Object value = e.getValue();
                target.startElement(n.getNamespaceURI(),n.getLocalPart(),n.getPrefix(),null);
                if(value==null) {
                    target.writeXsiNilTrue();
                } else {
                    target.childAsXsiType(value,"value",tbi, false);
                }
                target.endElement();
            } else {
                try {
                    bi.property.serializeBody(e,target,e);
                } catch (AccessorException x) {
                    target.reportError(null,x);
                }
            }
        }

        public void serializeURIs(JAXBElement o, XMLSerializer target) {
        }

        public boolean hasSerializeURIAction() {
            return false;
        }

        public String getIdValue(JAXBElement o) {
            return null;
        }

        public PropertyKind getKind() {
            return PropertyKind.ELEMENT;
        }

        public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> handlers) {
        }

        public Accessor getElementPropertyAccessor(String nsUri, String localName) {
            throw new UnsupportedOperationException();
        }

        public void wrapUp() {
        }

        public RuntimePropertyInfo getInfo() {
            return property.getInfo();
        }

        public boolean isHiddenByOverride() {
            return false;
        }

        public void setHiddenByOverride(boolean hidden) {
            throw new UnsupportedOperationException("Not supported on jaxbelements.");
        }

        public String getFieldName() {
            return null;
        }

    };
}
 
Example #18
Source File: ElementBeanInfoImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The constructor for the sole instanceof {@link JaxBeanInfo} for
 * handling user-created {@link JAXBElement}.
 *
 * Such {@link JaxBeanInfo} is used only for marshalling.
 *
 * This is a hack.
 */
protected ElementBeanInfoImpl(final JAXBContextImpl grammar) {
    super(grammar,null,JAXBElement.class,true,false,true);
    tagName = null;
    expectedType = null;
    scope = null;
    constructor = null;

    this.property = new Property<JAXBElement>() {
        public void reset(JAXBElement o) {
            throw new UnsupportedOperationException();
        }

        public void serializeBody(JAXBElement e, XMLSerializer target, Object outerPeer) throws SAXException, IOException, XMLStreamException {
            Class scope = e.getScope();
            if(e.isGlobalScope())   scope = null;
            QName n = e.getName();
            ElementBeanInfoImpl bi = grammar.getElement(scope,n);
            if(bi==null) {
                // infer what to do from the type
                JaxBeanInfo tbi;
                try {
                    tbi = grammar.getBeanInfo(e.getDeclaredType(),true);
                } catch (JAXBException x) {
                    // if e.getDeclaredType() isn't known to this JAXBContext
                    target.reportError(null,x);
                    return;
                }
                Object value = e.getValue();
                target.startElement(n.getNamespaceURI(),n.getLocalPart(),n.getPrefix(),null);
                if(value==null) {
                    target.writeXsiNilTrue();
                } else {
                    target.childAsXsiType(value,"value",tbi, false);
                }
                target.endElement();
            } else {
                try {
                    bi.property.serializeBody(e,target,e);
                } catch (AccessorException x) {
                    target.reportError(null,x);
                }
            }
        }

        public void serializeURIs(JAXBElement o, XMLSerializer target) {
        }

        public boolean hasSerializeURIAction() {
            return false;
        }

        public String getIdValue(JAXBElement o) {
            return null;
        }

        public PropertyKind getKind() {
            return PropertyKind.ELEMENT;
        }

        public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> handlers) {
        }

        public Accessor getElementPropertyAccessor(String nsUri, String localName) {
            throw new UnsupportedOperationException();
        }

        public void wrapUp() {
        }

        public RuntimePropertyInfo getInfo() {
            return property.getInfo();
        }

        public boolean isHiddenByOverride() {
            return false;
        }

        public void setHiddenByOverride(boolean hidden) {
            throw new UnsupportedOperationException("Not supported on jaxbelements.");
        }

        public String getFieldName() {
            return null;
        }

    };
}
 
Example #19
Source File: ElementBeanInfoImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The constructor for the sole instanceof {@link JaxBeanInfo} for
 * handling user-created {@link JAXBElement}.
 *
 * Such {@link JaxBeanInfo} is used only for marshalling.
 *
 * This is a hack.
 */
protected ElementBeanInfoImpl(final JAXBContextImpl grammar) {
    super(grammar,null,JAXBElement.class,true,false,true);
    tagName = null;
    expectedType = null;
    scope = null;
    constructor = null;

    this.property = new Property<JAXBElement>() {
        public void reset(JAXBElement o) {
            throw new UnsupportedOperationException();
        }

        public void serializeBody(JAXBElement e, XMLSerializer target, Object outerPeer) throws SAXException, IOException, XMLStreamException {
            Class scope = e.getScope();
            if(e.isGlobalScope())   scope = null;
            QName n = e.getName();
            ElementBeanInfoImpl bi = grammar.getElement(scope,n);
            if(bi==null) {
                // infer what to do from the type
                JaxBeanInfo tbi;
                try {
                    tbi = grammar.getBeanInfo(e.getDeclaredType(),true);
                } catch (JAXBException x) {
                    // if e.getDeclaredType() isn't known to this JAXBContext
                    target.reportError(null,x);
                    return;
                }
                Object value = e.getValue();
                target.startElement(n.getNamespaceURI(),n.getLocalPart(),n.getPrefix(),null);
                if(value==null) {
                    target.writeXsiNilTrue();
                } else {
                    target.childAsXsiType(value,"value",tbi, false);
                }
                target.endElement();
            } else {
                try {
                    bi.property.serializeBody(e,target,e);
                } catch (AccessorException x) {
                    target.reportError(null,x);
                }
            }
        }

        public void serializeURIs(JAXBElement o, XMLSerializer target) {
        }

        public boolean hasSerializeURIAction() {
            return false;
        }

        public String getIdValue(JAXBElement o) {
            return null;
        }

        public PropertyKind getKind() {
            return PropertyKind.ELEMENT;
        }

        public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> handlers) {
        }

        public Accessor getElementPropertyAccessor(String nsUri, String localName) {
            throw new UnsupportedOperationException();
        }

        public void wrapUp() {
        }

        public RuntimePropertyInfo getInfo() {
            return property.getInfo();
        }

        public boolean isHiddenByOverride() {
            return false;
        }

        public void setHiddenByOverride(boolean hidden) {
            throw new UnsupportedOperationException("Not supported on jaxbelements.");
        }

        public String getFieldName() {
            return null;
        }

    };
}
 
Example #20
Source File: ElementBeanInfoImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The constructor for the sole instanceof {@link JaxBeanInfo} for
 * handling user-created {@link JAXBElement}.
 *
 * Such {@link JaxBeanInfo} is used only for marshalling.
 *
 * This is a hack.
 */
protected ElementBeanInfoImpl(final JAXBContextImpl grammar) {
    super(grammar,null,JAXBElement.class,true,false,true);
    tagName = null;
    expectedType = null;
    scope = null;
    constructor = null;

    this.property = new Property<JAXBElement>() {
        public void reset(JAXBElement o) {
            throw new UnsupportedOperationException();
        }

        public void serializeBody(JAXBElement e, XMLSerializer target, Object outerPeer) throws SAXException, IOException, XMLStreamException {
            Class scope = e.getScope();
            if(e.isGlobalScope())   scope = null;
            QName n = e.getName();
            ElementBeanInfoImpl bi = grammar.getElement(scope,n);
            if(bi==null) {
                // infer what to do from the type
                JaxBeanInfo tbi;
                try {
                    tbi = grammar.getBeanInfo(e.getDeclaredType(),true);
                } catch (JAXBException x) {
                    // if e.getDeclaredType() isn't known to this JAXBContext
                    target.reportError(null,x);
                    return;
                }
                Object value = e.getValue();
                target.startElement(n.getNamespaceURI(),n.getLocalPart(),n.getPrefix(),null);
                if(value==null) {
                    target.writeXsiNilTrue();
                } else {
                    target.childAsXsiType(value,"value",tbi, false);
                }
                target.endElement();
            } else {
                try {
                    bi.property.serializeBody(e,target,e);
                } catch (AccessorException x) {
                    target.reportError(null,x);
                }
            }
        }

        public void serializeURIs(JAXBElement o, XMLSerializer target) {
        }

        public boolean hasSerializeURIAction() {
            return false;
        }

        public String getIdValue(JAXBElement o) {
            return null;
        }

        public PropertyKind getKind() {
            return PropertyKind.ELEMENT;
        }

        public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> handlers) {
        }

        public Accessor getElementPropertyAccessor(String nsUri, String localName) {
            throw new UnsupportedOperationException();
        }

        public void wrapUp() {
        }

        public RuntimePropertyInfo getInfo() {
            return property.getInfo();
        }

        public boolean isHiddenByOverride() {
            return false;
        }

        public void setHiddenByOverride(boolean hidden) {
            throw new UnsupportedOperationException("Not supported on jaxbelements.");
        }

        public String getFieldName() {
            return null;
        }

    };
}
 
Example #21
Source File: ElementBeanInfoImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The constructor for the sole instanceof {@link JaxBeanInfo} for
 * handling user-created {@link JAXBElement}.
 *
 * Such {@link JaxBeanInfo} is used only for marshalling.
 *
 * This is a hack.
 */
protected ElementBeanInfoImpl(final JAXBContextImpl grammar) {
    super(grammar,null,JAXBElement.class,true,false,true);
    tagName = null;
    expectedType = null;
    scope = null;
    constructor = null;

    this.property = new Property<JAXBElement>() {
        public void reset(JAXBElement o) {
            throw new UnsupportedOperationException();
        }

        public void serializeBody(JAXBElement e, XMLSerializer target, Object outerPeer) throws SAXException, IOException, XMLStreamException {
            Class scope = e.getScope();
            if(e.isGlobalScope())   scope = null;
            QName n = e.getName();
            ElementBeanInfoImpl bi = grammar.getElement(scope,n);
            if(bi==null) {
                // infer what to do from the type
                JaxBeanInfo tbi;
                try {
                    tbi = grammar.getBeanInfo(e.getDeclaredType(),true);
                } catch (JAXBException x) {
                    // if e.getDeclaredType() isn't known to this JAXBContext
                    target.reportError(null,x);
                    return;
                }
                Object value = e.getValue();
                target.startElement(n.getNamespaceURI(),n.getLocalPart(),n.getPrefix(),null);
                if(value==null) {
                    target.writeXsiNilTrue();
                } else {
                    target.childAsXsiType(value,"value",tbi, false);
                }
                target.endElement();
            } else {
                try {
                    bi.property.serializeBody(e,target,e);
                } catch (AccessorException x) {
                    target.reportError(null,x);
                }
            }
        }

        public void serializeURIs(JAXBElement o, XMLSerializer target) {
        }

        public boolean hasSerializeURIAction() {
            return false;
        }

        public String getIdValue(JAXBElement o) {
            return null;
        }

        public PropertyKind getKind() {
            return PropertyKind.ELEMENT;
        }

        public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> handlers) {
        }

        public Accessor getElementPropertyAccessor(String nsUri, String localName) {
            throw new UnsupportedOperationException();
        }

        public void wrapUp() {
        }

        public RuntimePropertyInfo getInfo() {
            return property.getInfo();
        }

        public boolean isHiddenByOverride() {
            return false;
        }

        public void setHiddenByOverride(boolean hidden) {
            throw new UnsupportedOperationException("Not supported on jaxbelements.");
        }

        public String getFieldName() {
            return null;
        }

    };
}
 
Example #22
Source File: ElementBeanInfoImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The constructor for the sole instanceof {@link JaxBeanInfo} for
 * handling user-created {@link JAXBElement}.
 *
 * Such {@link JaxBeanInfo} is used only for marshalling.
 *
 * This is a hack.
 */
protected ElementBeanInfoImpl(final JAXBContextImpl grammar) {
    super(grammar,null,JAXBElement.class,true,false,true);
    tagName = null;
    expectedType = null;
    scope = null;
    constructor = null;

    this.property = new Property<JAXBElement>() {
        public void reset(JAXBElement o) {
            throw new UnsupportedOperationException();
        }

        public void serializeBody(JAXBElement e, XMLSerializer target, Object outerPeer) throws SAXException, IOException, XMLStreamException {
            Class scope = e.getScope();
            if(e.isGlobalScope())   scope = null;
            QName n = e.getName();
            ElementBeanInfoImpl bi = grammar.getElement(scope,n);
            if(bi==null) {
                // infer what to do from the type
                JaxBeanInfo tbi;
                try {
                    tbi = grammar.getBeanInfo(e.getDeclaredType(),true);
                } catch (JAXBException x) {
                    // if e.getDeclaredType() isn't known to this JAXBContext
                    target.reportError(null,x);
                    return;
                }
                Object value = e.getValue();
                target.startElement(n.getNamespaceURI(),n.getLocalPart(),n.getPrefix(),null);
                if(value==null) {
                    target.writeXsiNilTrue();
                } else {
                    target.childAsXsiType(value,"value",tbi, false);
                }
                target.endElement();
            } else {
                try {
                    bi.property.serializeBody(e,target,e);
                } catch (AccessorException x) {
                    target.reportError(null,x);
                }
            }
        }

        public void serializeURIs(JAXBElement o, XMLSerializer target) {
        }

        public boolean hasSerializeURIAction() {
            return false;
        }

        public String getIdValue(JAXBElement o) {
            return null;
        }

        public PropertyKind getKind() {
            return PropertyKind.ELEMENT;
        }

        public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> handlers) {
        }

        public Accessor getElementPropertyAccessor(String nsUri, String localName) {
            throw new UnsupportedOperationException();
        }

        public void wrapUp() {
        }

        public RuntimePropertyInfo getInfo() {
            return property.getInfo();
        }

        public boolean isHiddenByOverride() {
            return false;
        }

        public void setHiddenByOverride(boolean hidden) {
            throw new UnsupportedOperationException("Not supported on jaxbelements.");
        }

        public String getFieldName() {
            return null;
        }

    };
}
 
Example #23
Source File: ElementBeanInfoImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The constructor for the sole instanceof {@link JaxBeanInfo} for
 * handling user-created {@link JAXBElement}.
 *
 * Such {@link JaxBeanInfo} is used only for marshalling.
 *
 * This is a hack.
 */
protected ElementBeanInfoImpl(final JAXBContextImpl grammar) {
    super(grammar,null,JAXBElement.class,true,false,true);
    tagName = null;
    expectedType = null;
    scope = null;
    constructor = null;

    this.property = new Property<JAXBElement>() {
        public void reset(JAXBElement o) {
            throw new UnsupportedOperationException();
        }

        public void serializeBody(JAXBElement e, XMLSerializer target, Object outerPeer) throws SAXException, IOException, XMLStreamException {
            Class scope = e.getScope();
            if(e.isGlobalScope())   scope = null;
            QName n = e.getName();
            ElementBeanInfoImpl bi = grammar.getElement(scope,n);
            if(bi==null) {
                // infer what to do from the type
                JaxBeanInfo tbi;
                try {
                    tbi = grammar.getBeanInfo(e.getDeclaredType(),true);
                } catch (JAXBException x) {
                    // if e.getDeclaredType() isn't known to this JAXBContext
                    target.reportError(null,x);
                    return;
                }
                Object value = e.getValue();
                target.startElement(n.getNamespaceURI(),n.getLocalPart(),n.getPrefix(),null);
                if(value==null) {
                    target.writeXsiNilTrue();
                } else {
                    target.childAsXsiType(value,"value",tbi, false);
                }
                target.endElement();
            } else {
                try {
                    bi.property.serializeBody(e,target,e);
                } catch (AccessorException x) {
                    target.reportError(null,x);
                }
            }
        }

        public void serializeURIs(JAXBElement o, XMLSerializer target) {
        }

        public boolean hasSerializeURIAction() {
            return false;
        }

        public String getIdValue(JAXBElement o) {
            return null;
        }

        public PropertyKind getKind() {
            return PropertyKind.ELEMENT;
        }

        public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> handlers) {
        }

        public Accessor getElementPropertyAccessor(String nsUri, String localName) {
            throw new UnsupportedOperationException();
        }

        public void wrapUp() {
        }

        public RuntimePropertyInfo getInfo() {
            return property.getInfo();
        }

        public boolean isHiddenByOverride() {
            return false;
        }

        public void setHiddenByOverride(boolean hidden) {
            throw new UnsupportedOperationException("Not supported on jaxbelements.");
        }

        public String getFieldName() {
            return null;
        }

    };
}
 
Example #24
Source File: ElementBeanInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The constructor for the sole instanceof {@link JaxBeanInfo} for
 * handling user-created {@link JAXBElement}.
 *
 * Such {@link JaxBeanInfo} is used only for marshalling.
 *
 * This is a hack.
 */
protected ElementBeanInfoImpl(final JAXBContextImpl grammar) {
    super(grammar,null,JAXBElement.class,true,false,true);
    tagName = null;
    expectedType = null;
    scope = null;
    constructor = null;

    this.property = new Property<JAXBElement>() {
        public void reset(JAXBElement o) {
            throw new UnsupportedOperationException();
        }

        public void serializeBody(JAXBElement e, XMLSerializer target, Object outerPeer) throws SAXException, IOException, XMLStreamException {
            Class scope = e.getScope();
            if(e.isGlobalScope())   scope = null;
            QName n = e.getName();
            ElementBeanInfoImpl bi = grammar.getElement(scope,n);
            if(bi==null) {
                // infer what to do from the type
                JaxBeanInfo tbi;
                try {
                    tbi = grammar.getBeanInfo(e.getDeclaredType(),true);
                } catch (JAXBException x) {
                    // if e.getDeclaredType() isn't known to this JAXBContext
                    target.reportError(null,x);
                    return;
                }
                Object value = e.getValue();
                target.startElement(n.getNamespaceURI(),n.getLocalPart(),n.getPrefix(),null);
                if(value==null) {
                    target.writeXsiNilTrue();
                } else {
                    target.childAsXsiType(value,"value",tbi, false);
                }
                target.endElement();
            } else {
                try {
                    bi.property.serializeBody(e,target,e);
                } catch (AccessorException x) {
                    target.reportError(null,x);
                }
            }
        }

        public void serializeURIs(JAXBElement o, XMLSerializer target) {
        }

        public boolean hasSerializeURIAction() {
            return false;
        }

        public String getIdValue(JAXBElement o) {
            return null;
        }

        public PropertyKind getKind() {
            return PropertyKind.ELEMENT;
        }

        public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> handlers) {
        }

        public Accessor getElementPropertyAccessor(String nsUri, String localName) {
            throw new UnsupportedOperationException();
        }

        public void wrapUp() {
        }

        public RuntimePropertyInfo getInfo() {
            return property.getInfo();
        }

        public boolean isHiddenByOverride() {
            return false;
        }

        public void setHiddenByOverride(boolean hidden) {
            throw new UnsupportedOperationException("Not supported on jaxbelements.");
        }

        public String getFieldName() {
            return null;
        }

    };
}