Package org.apache.cxf.databinding

Examples of org.apache.cxf.databinding.WrapperHelper


            }
            if (wrapperClass == null || wrappedObject == null) {
                return;
            }
           
            WrapperHelper helper = wrapperPart.getProperty("WRAPPER_CLASS", WrapperHelper.class);
            if (helper == null) {
                Service service = ServiceModelUtil.getService(message.getExchange());
                DataBinding dataBinding = service.getDataBinding();
                if (dataBinding instanceof WrapperCapableDatabinding) {
                    helper = createWrapperHelper((WrapperCapableDatabinding)dataBinding,
                                                 messageInfo, wrappedMessageInfo, wrapperClass);
                    wrapperPart.setProperty("WRAPPER_CLASS", helper);
                } else {
                    return;
                }               
            }           
           
            MessageContentsList newParams;
            try {
                newParams = new MessageContentsList(helper.getWrapperParts(wrappedObject));
               
                List<Integer> removes = null;
                int count = 0;
                for (MessagePartInfo part : messageInfo.getMessageParts()) {
                    if (Boolean.TRUE.equals(part.getProperty(ReflectionServiceFactoryBean.HEADER))) {
View Full Code Here


        List<Class<?>> partClasses = Arrays.asList(new Class<?>[] {List.class});
          
        String className = requestClass.getName();
        className = className.substring(0, className.lastIndexOf(".") + 1);
       
        WrapperHelper wh = new JAXBDataBinding().createWrapperHelper(requestClass,
                                                             partNames, elTypeNames, partClasses);       
       
        List<Object> paraList = new ArrayList<Object>();
        List<String> valueList = new ArrayList<String>();
        valueList.add("str1");
        valueList.add("str2");
        valueList.add("str3");
        paraList.add(valueList);
        Object requestObj = wh.createWrapperObject(paraList);
        // Create response wrapper Object
       
        partNames = Arrays.asList(new String[] {"return"});
        elTypeNames = Arrays.asList(new String[] {"list"});
        partClasses = Arrays.asList(new Class<?>[] {List.class});
          
        className = responseClass.getName();
        className = className.substring(0, className.lastIndexOf(".") + 1);
       
        wh = new JAXBDataBinding().createWrapperHelper(responseClass,
                                                             partNames, elTypeNames, partClasses);       
        List<Object> resPara = new ArrayList<Object>();
        List<Integer> intValueList = new ArrayList<Integer>();
        intValueList.add(1);
        intValueList.add(2);
        intValueList.add(3);
        resPara.add(intValueList);
        Object responseObj = wh.createWrapperObject(resPara);
             
        JAXBContext jaxbContext = JAXBContext.newInstance(requestClass, responseClass);
        java.io.ByteArrayOutputStream bout = new java.io.ByteArrayOutputStream();
        Marshaller marshaller = jaxbContext.createMarshaller();
       
View Full Code Here

   
    private static WrapperHelper createWrapperHelper(Class<?> wrapperType, Method setMethods[],
                                                     Method getMethods[], Method jaxbMethods[],
                                                     Field fields[], Object objectFactory) {

        WrapperHelper wh = compileWrapperHelper(wrapperType, setMethods, getMethods, jaxbMethods, fields,
                                                objectFactory);

        if (wh == null) {
            wh = new JAXBWrapperHelper(wrapperType, setMethods, getMethods, jaxbMethods, fields,
                                       objectFactory);
View Full Code Here

            boolean[].class,
            String.class,
            List.class,
        });
       
        WrapperHelper wh = new JAXBDataBinding().createWrapperHelper(SetIsOK.class,
                                          partNames,
                                          elTypeNames,
                                          partClasses);
       
        List<Object> lst = wh.getWrapperParts(ok);
        assertEquals(5, lst.size());
        assertTrue(lst.get(0) instanceof Boolean);
        assertTrue(lst.get(1) instanceof Integer);
        assertTrue(lst.get(2) instanceof boolean[]);
        assertTrue(((boolean[])lst.get(2))[0]);
        assertFalse(((boolean[])lst.get(2))[1]);
        assertEquals("hello", (String)lst.get(3));

        lst.set(0, Boolean.TRUE);
        Object o = wh.createWrapperObject(lst);
        assertNotNull(0);
        ok = (SetIsOK)o;
        assertTrue(ok.isParameter1());
        assertTrue(ok.getParameter3()[0]);
        assertFalse(ok.getParameter3()[1]);
View Full Code Here

        newClassName = periodToSlashes(newClassName);

        Class<?> cls = super.findClass(newClassName.replace('/', '.'), wrapperType);
        while (cls != null) {
            try {
                WrapperHelper helper = WrapperHelper.class.cast(cls.newInstance());
                if (!helper.getSignature().equals(computeSignature())) {
                    count++;
                    newClassName = wrapperType.getName() + "_WrapperTypeHelper" + count;
                    newClassName = newClassName.replaceAll("\\$", ".");
                    newClassName = periodToSlashes(newClassName);
                    cls = super.findClass(newClassName.replace('/', '.'), wrapperType);
View Full Code Here

            boolean[].class,
            String.class,
            List.class,
        });
       
        WrapperHelper wh = new JAXBDataBinding().createWrapperHelper(SetIsOK.class,
                                                                     null,
                                          partNames,
                                          elTypeNames,
                                          partClasses);
       
        List<Object> lst = wh.getWrapperParts(ok);
        assertEquals(5, lst.size());
        assertTrue(lst.get(0) instanceof Boolean);
        assertTrue(lst.get(1) instanceof Integer);
        assertTrue(lst.get(2) instanceof boolean[]);
        assertTrue(((boolean[])lst.get(2))[0]);
        assertFalse(((boolean[])lst.get(2))[1]);
        assertEquals("hello", lst.get(3));

        lst.set(0, Boolean.TRUE);
        Object o = wh.createWrapperObject(lst);
        assertNotNull(0);
        ok = (SetIsOK)o;
        assertTrue(ok.isParameter1());
        assertTrue(ok.getParameter3()[0]);
        assertFalse(ok.getParameter3()[1]);
View Full Code Here

        List<Class<?>> partClasses = Arrays.asList(new Class<?>[] {List.class});
          
        String className = requestClass.getName();
        className = className.substring(0, className.lastIndexOf(".") + 1);
       
        WrapperHelper wh = new JAXBDataBinding().createWrapperHelper(requestClass, null,
                                                             partNames, elTypeNames, partClasses);       
       
        List<Object> paraList = new ArrayList<Object>();
        List<String> valueList = new ArrayList<String>();
        valueList.add("str1");
        valueList.add("str2");
        valueList.add("str3");
        paraList.add(valueList);
        Object requestObj = wh.createWrapperObject(paraList);
        // Create response wrapper Object
       
        partNames = Arrays.asList(new String[] {"return"});
        elTypeNames = Arrays.asList(new String[] {"list"});
        partClasses = Arrays.asList(new Class<?>[] {List.class});
          
        className = responseClass.getName();
        className = className.substring(0, className.lastIndexOf(".") + 1);
       
        wh = new JAXBDataBinding().createWrapperHelper(responseClass, null,
                                                             partNames, elTypeNames, partClasses);       
        List<Object> resPara = new ArrayList<Object>();
        List<Integer> intValueList = new ArrayList<Integer>();
        intValueList.add(1);
        intValueList.add(2);
        intValueList.add(3);
        resPara.add(intValueList);
        Object responseObj = wh.createWrapperObject(resPara);
             
        JAXBContext jaxbContext = JAXBContext.newInstance(requestClass, responseClass);
        java.io.ByteArrayOutputStream bout = new java.io.ByteArrayOutputStream();
        Marshaller marshaller = jaxbContext.createMarshaller();
       
View Full Code Here

            }
            if (wrapperClass == null || wrappedObject == null) {
                return;
            }
           
            WrapperHelper helper = wrapperPart.getProperty("WRAPPER_CLASS", WrapperHelper.class);
            if (helper == null) {
                Service service = ServiceModelUtil.getService(message.getExchange());
                DataBinding dataBinding = service.getDataBinding();
                if (dataBinding instanceof WrapperCapableDatabinding) {
                    helper = createWrapperHelper((WrapperCapableDatabinding)dataBinding,
                                                 messageInfo, wrappedMessageInfo, wrapperClass);
                    wrapperPart.setProperty("WRAPPER_CLASS", helper);
                } else {
                    return;
                }               
            }           
           
            MessageContentsList newParams;
            try {
                newParams = new MessageContentsList(helper.getWrapperParts(wrappedObject));
               
                List<Integer> removes = null;
                int count = 0;
                for (MessagePartInfo part : messageInfo.getMessageParts()) {
                    if (Boolean.TRUE.equals(part.getProperty(ReflectionServiceFactoryBean.HEADER))) {
View Full Code Here

        newClassName = periodToSlashes(newClassName);

        Class<?> cls = super.findClass(newClassName.replace('/', '.'), wrapperType);
        while (cls != null) {
            try {
                WrapperHelper helper = WrapperHelper.class.cast(cls.newInstance());
                if (!helper.getSignature().equals(computeSignature())) {
                    count++;
                    newClassName = wrapperType.getName() + "_WrapperTypeHelper" + count;
                    newClassName = newClassName.replaceAll("\\$", ".");
                    newClassName = periodToSlashes(newClassName);
                    cls = super.findClass(newClassName.replace('/', '.'), wrapperType);
View Full Code Here

    private static WrapperHelper createWrapperHelper(Class<?> wrapperType, Method setMethods[],
                                                     Method getMethods[], Method jaxbMethods[],
                                                     Field fields[], Object objectFactory) {

        WrapperHelper wh = compileWrapperHelper(wrapperType, setMethods, getMethods, jaxbMethods, fields,
                                                objectFactory);

        if (wh == null) {
            wh = new JAXBWrapperHelper(wrapperType, setMethods, getMethods, jaxbMethods, fields,
                                       objectFactory);
View Full Code Here

TOP

Related Classes of org.apache.cxf.databinding.WrapperHelper

Copyright © 2018 www.massapicom. 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.