Examples of XmlJavaTypeAdapter


Examples of javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter

                }
            }
        }

        Annotation[] anns = (Annotation[])part.getProperty("parameter.annotations");
        XmlJavaTypeAdapter jta = findFromTypeAdapter(context, clazz, anns);
        JAXBBeanInfo jtaBeanInfo = null;
        if (jta != null) {
            jtaBeanInfo = findFromTypeAdapter(context, jta.value());
        }
        JAXBBeanInfo beanInfo = getBeanInfo(clazz);
        if (jtaBeanInfo != beanInfo && jta != null) {
            beanInfo = jtaBeanInfo;
            if (anns == null) {
View Full Code Here

Examples of javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter

                    }
                }
            }
        }
        if (clazz != null) {
            XmlJavaTypeAdapter xjta = clazz.getAnnotation(XmlJavaTypeAdapter.class);
            if (xjta != null) {
                ret = findFromTypeAdapter(context, xjta.value());
                if (ret != null) {
                    return xjta;
                }
            }
        }
View Full Code Here

Examples of javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter

            endTag = "}";
        }
       
        os.write(startTag.getBytes());
        if (firstObj != null) {
            XmlJavaTypeAdapter adapter =
                org.apache.cxf.jaxrs.utils.JAXBUtils.getAdapter(firstObj.getClass(), anns);
            marshalCollectionMember(JAXBUtils.useAdapter(firstObj, adapter, true),
                                    actualClass, genericType, encoding, os);
            while (it.hasNext()) {
                os.write(",".getBytes());
View Full Code Here

Examples of javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter

        }
    }
    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);
            }
View Full Code Here

Examples of javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter

                        addType(t);
                    }
                }
            }
        }
        XmlJavaTypeAdapter xjta = clazz.getAnnotation(XmlJavaTypeAdapter.class);
        if (xjta != null) {
            Type t = Utils.getTypeFromXmlAdapter(xjta);
            if (t != null) {
                addType(t);
            }
View Full Code Here

Examples of javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter

                if (xsa != null) {
                    for (Class<?> c : xsa.value()) {
                        addClass(c);
                    }
                }
                XmlJavaTypeAdapter xjta = cls.getAnnotation(XmlJavaTypeAdapter.class);
                if (xjta != null) {
                    //has an adapter.   We need to inspect the adapter and then
                    //return as the adapter will handle the superclass
                    //and interfaces and such
                    Type t = Utils.getTypeFromXmlAdapter(xjta);
View Full Code Here

Examples of javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter

            //fields are accessible even if not public, must look at the declared fields
            //then walk to parents declared fields, etc...
            Field fields[] = ReflectionUtil.getDeclaredFields(cls);
            for (Field f : fields) {
                if (isFieldAccepted(f, accessType)) {
                    XmlJavaTypeAdapter xjta = Utils.getFieldXJTA(f);
                    if (xjta != null) {
                        Type t = Utils.getTypeFromXmlAdapter(xjta);
                        if (t != null) {
                            addType(t);
                            continue;
                        }
                    }
                    addType(f.getGenericType());
                }
            }
            walkReferences(cls.getSuperclass());
        }

        if (accessType != XmlAccessType.FIELD) {   // only look for methods if we are instructed to
            Method methods[] = ReflectionUtil.getDeclaredMethods(cls);
            for (Method m : methods) {
                if (isMethodAccepted(m, accessType)) {
                    XmlJavaTypeAdapter xjta = Utils.getMethodXJTA(m);
                    if (xjta != null) {
                        Type t = Utils.getTypeFromXmlAdapter(xjta);
                        if (t != null) {
                            addType(t);
                            continue;
View Full Code Here

Examples of javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter

        return theType;
    }
   
    @SuppressWarnings("unchecked")
    protected Object checkAdapter(Object obj, Annotation[] anns) {
        XmlJavaTypeAdapter typeAdapter = AnnotationUtils.getAnnotation(anns, XmlJavaTypeAdapter.class);
        if (typeAdapter != null) {
            try {
                XmlAdapter xmlAdapter = typeAdapter.value().newInstance();
                return xmlAdapter.marshal(obj);
            } catch (Exception ex) {
                LOG.warning("Problem using the XmlJavaTypeAdapter");
                ex.printStackTrace();
            }
View Full Code Here

Examples of javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter

        }

        JAXBBeanInfo beanInfo = getBeanInfo(clazz);
        if (beanInfo == null) {
            Annotation[] anns = (Annotation[])part.getProperty("parameter.annotations");
            XmlJavaTypeAdapter jta = findFromTypeAdapter(clazz, anns);
            if (jta != null) {
                beanInfo = findFromTypeAdapter(jta.value());
                if (anns == null) {
                    anns = new Annotation[] {jta};
                } else {
                    boolean found = false;
                    for (Annotation t : anns) {
View Full Code Here

Examples of javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter

                        return (XmlJavaTypeAdapter)a;
                    }
                }
            }
        }
        XmlJavaTypeAdapter xjta = clazz.getAnnotation(XmlJavaTypeAdapter.class);
        if (xjta != null) {
            ret = findFromTypeAdapter(xjta.value());
            if (ret != null) {
                return xjta;
            }
        }
        return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.