Search in sources :

Example 1 with JAXBContextProxy

use of org.apache.cxf.common.jaxb.JAXBContextProxy in project tomee by apache.

the class JAXBDataBinding method checkForJAXBAnnotations.

private void checkForJAXBAnnotations(MessagePartInfo mpi, SchemaCollection schemaCollection, String ns) {
    Annotation[] anns = (Annotation[]) mpi.getProperty("parameter.annotations");
    JAXBContextProxy ctx = JAXBUtils.createJAXBContextProxy(context, schemaCollection, ns);
    XmlJavaTypeAdapter jta = JAXBSchemaInitializer.findFromTypeAdapter(ctx, mpi.getTypeClass(), anns);
    if (jta != null) {
        JAXBBeanInfo jtaBeanInfo = JAXBSchemaInitializer.findFromTypeAdapter(ctx, jta.value());
        JAXBBeanInfo beanInfo = JAXBSchemaInitializer.getBeanInfo(ctx, mpi.getTypeClass());
        if (jtaBeanInfo != beanInfo) {
            mpi.setProperty("parameter.annotations", anns);
            mpi.setProperty("honor.jaxb.annotations", Boolean.TRUE);
        }
    }
}
Also used : XmlJavaTypeAdapter(javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter) JAXBBeanInfo(org.apache.cxf.common.jaxb.JAXBBeanInfo) Annotation(java.lang.annotation.Annotation) JAXBContextProxy(org.apache.cxf.common.jaxb.JAXBContextProxy)

Example 2 with JAXBContextProxy

use of org.apache.cxf.common.jaxb.JAXBContextProxy in project cxf by apache.

the class JAXBDataBinding method checkForJAXBAnnotations.

private void checkForJAXBAnnotations(MessagePartInfo mpi, SchemaCollection schemaCollection, String ns) {
    Annotation[] anns = (Annotation[]) mpi.getProperty("parameter.annotations");
    JAXBContextProxy ctx = JAXBUtils.createJAXBContextProxy(context, schemaCollection, ns);
    XmlJavaTypeAdapter jta = JAXBSchemaInitializer.findFromTypeAdapter(ctx, mpi.getTypeClass(), anns);
    if (jta != null) {
        JAXBBeanInfo jtaBeanInfo = JAXBSchemaInitializer.findFromTypeAdapter(ctx, jta.value());
        JAXBBeanInfo beanInfo = JAXBSchemaInitializer.getBeanInfo(ctx, mpi.getTypeClass());
        if (jtaBeanInfo != beanInfo) {
            mpi.setProperty("parameter.annotations", anns);
            mpi.setProperty("honor.jaxb.annotations", Boolean.TRUE);
        }
    }
}
Also used : XmlJavaTypeAdapter(javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter) JAXBBeanInfo(org.apache.cxf.common.jaxb.JAXBBeanInfo) Annotation(java.lang.annotation.Annotation) JAXBContextProxy(org.apache.cxf.common.jaxb.JAXBContextProxy)

Aggregations

Annotation (java.lang.annotation.Annotation)2 XmlJavaTypeAdapter (javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter)2 JAXBBeanInfo (org.apache.cxf.common.jaxb.JAXBBeanInfo)2 JAXBContextProxy (org.apache.cxf.common.jaxb.JAXBContextProxy)2