Examples of registerBeanClass()


Examples of org.apache.commons.betwixt.io.BeanReader.registerBeanClass()

        StringReader in = new StringReader( xml );
       
        BeanReader reader = new BeanReader();
        reader.getBindingConfiguration().setMapIDs( false );

        reader.registerBeanClass( ArrayListExtender.class );
        ArrayListExtender bean = (ArrayListExtender) reader.parse( in );
       
        assertEquals("Whatever", bean.getAnother());
    }
}
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanReader.registerBeanClass()

        beanWriter.getBindingConfiguration().setMapIDs(true);
        beanWriter.write(map);
        BeanReader beanReader = new BeanReader();
       
        // Configure the reader
        beanReader.registerBeanClass(MapBean.class);
        StringReader xmlReader = new StringReader(outputWriter.toString());
       
        //Parse the xml
        MapBean result = (MapBean) beanReader.parse(xmlReader);
        assertNotNull("Should have deserialized a MapBean but got null.", result);
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanReader.registerBeanClass()

                    true);
       
        // now we'll test reading via round tripping
        BeanReader reader = new BeanReader();
        reader.getBindingConfiguration().setMapIDs(false);
        reader.registerBeanClass("mixed", MixedUpdatersBean.class);
        bean = (MixedUpdatersBean) reader.parse(new StringReader(xml));
       
        assertEquals("Name incorrect", "Lov", bean.getName());
        assertEquals("BadName incorrect", "Hate", bean.getBadName());
        List items = bean.getItems();
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanReader.registerBeanClass()

        StringReader xml = new StringReader(
            "<?xml version='1.0' encoding='UTF-8'?><deep-thought alpha='Life' gamma='42'>"
            + "The Universe And Everything</deep-thought>");
           
        BeanReader reader = new BeanReader();
        reader.registerBeanClass(MixedContentOne.class);
        Object resultObject = reader.parse(xml);
        assertEquals("Object is MixedContentOne", true, resultObject instanceof MixedContentOne);
        MixedContentOne result = (MixedContentOne) resultObject;
        assertEquals("Property Alpha matches", "Life", result.getAlpha());
        assertEquals("Property Beta matches", "The Universe And Everything", result.getBeta());
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanReader.registerBeanClass()

       
       
        BeanReader reader = new BeanReader();
        reader.getXMLIntrospector().getConfiguration().setElementNameMapper(new HyphenatedNameMapper());
        reader.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(false);
        reader.registerBeanClass( ExampleBean.class );
       
        StringReader in = new StringReader( xml );
        ExampleBean out = (ExampleBean) reader.parse( in );
        assertEquals("Interface read failed", bean, out);
       
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanReader.registerBeanClass()

public class TestCyclicRegistration extends TestCase {
   
    public void testListReferenceCycle() throws Exception {

        BeanReader reader = new BeanReader();
        reader.registerBeanClass(PlanetBean.class);
    }
}
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanReader.registerBeanClass()

           
        };
       
        BeanReader reader = new BeanReader();
        reader.getBindingConfiguration().setIdMappingStrategy(storingStrategy);
        reader.registerBeanClass(ElementsList.class);
        ElementsList elements = (ElementsList) reader.parse(new StringReader(xml));
        assertNotNull(elements);
        Element one = elements.get(0);
        assertTrue(one == alpha);
        Element two = elements.get(1);
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanReader.registerBeanClass()

        MsgBean msg = null;
        BeanReader beanReader = new BeanReader();
        // Configure the reader
        beanReader.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(true);
        // Register beans so that betwixt knows what the xml is
        beanReader.registerBeanClass("message", MsgBean.class);
        StringReader stringReader = new StringReader(xmlMessage);
        return  (MsgBean) beanReader.parse(stringReader);
    }
   
   
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanReader.registerBeanClass()

    protected BeanReader createBeanReader(Class beanClass)
        throws Exception
    {
        BeanReader reader = new BeanReader();
        reader.setXMLIntrospector(createXMLIntrospector());
        reader.registerBeanClass(beanClass);
        return reader;
    }

    /**
     * ### it would be really nice to move this somewhere shareable across Maven
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanReader.registerBeanClass()

    protected BeanReader createBeanReader()
        throws Exception
    {
        BeanReader reader = new BeanReader();
        reader.setXMLIntrospector(createXMLIntrospector());
        reader.registerBeanClass(ScarabSettings.class);
        return reader;
    }

    /**
     * ### it would be really nice to move this somewhere shareable across Maven
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.