Examples of registerBeanClass()


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

        "</LibraryBean>";
       
        BeanReader reader = new BeanReader();
        reader.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(true);
        reader.getBindingConfiguration().setMapIDs(false);
        reader.registerBeanClass(LibraryBean.class);
        LibraryBean bean = (LibraryBean) reader.parse(new StringReader(xml));
       
        BookBean[] books = bean.getBooks();
        assertEquals("Three books read", 3, books.length);
        assertEquals("Book one", new BookBean("Martin Fowler", "Refactoring", "Addision Wesley"), books[0]);
View Full Code Here

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

        "</LibraryBeanWithArraySetter>";
       
        BeanReader reader = new BeanReader();
        reader.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(true);
        reader.getBindingConfiguration().setMapIDs(false);
        reader.registerBeanClass(LibraryBeanWithArraySetter.class);
        LibraryBeanWithArraySetter bean = (LibraryBeanWithArraySetter) reader.parse(new StringReader(xml));
       
        BookBean[] books = bean.getBooks();
        assertEquals("Three books read", 3, books.length);
        assertEquals("Book one", new BookBean("Martin Fowler", "Refactoring", "Addision Wesley"), books[0]);
View Full Code Here

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

        chain.insertBeanCreator(1, new EnumCreator());
       
        BeanReader reader = new BeanReader();
        reader.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(true);
        reader.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(false);
        reader.registerBeanClass("houses", HouseBeans.class);
        reader.getReadConfiguration().setBeanCreationChain(chain);
       
        StringReader in = new StringReader(xml);
        HouseBeans newHouses = (HouseBeans) reader.parse(in);
        assertNotNull("Parsing should return a bean", newHouses);
View Full Code Here

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

        chain.insertBeanCreator(1, new EnumCreator());
       
        BeanReader reader = new BeanReader();
        reader.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(true);
        reader.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(false);
        reader.registerBeanClass("houses", HouseBeans.class);
        reader.getReadConfiguration().setBeanCreationChain(chain);
       
        StringReader in = new StringReader(xml);
        HouseBeans newHouses = (HouseBeans) reader.parse(in);
        assertNotNull("Parsing should return a bean", newHouses);
View Full Code Here

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

    }
   
    public void run(String[] args) throws Exception {
        BeanReader reader = new BeanReader();
       
        reader.registerBeanClass( Channel.class );
       
        // Register local copies of the DTDs we understand
        for (int i = 0; i < registrations.length; i += 2) {
            URL url = RSSDigester.class.getResource(registrations[i + 1]);
            if (url != null) {
View Full Code Here

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

        "<line>\"By thy long grey beard and the glittering eye,</line>" +
        "<line>Now wherefore stopp'st thou me?\"</line>" +
        "</lines>" +
        "</PoemBean>";
        BeanReader reader = new BeanReader();
        reader.registerBeanClass(PoemBean.class);
        PoemBean bean = (PoemBean) reader.parse(new StringReader(xml));
        assertNotNull("Expected bean to be output");
        Object[] lines = bean.getLines().toArray();
        assertEquals("Expected four lines", 4, lines.length);
        assertEquals("First line of Rime Of The Ancient Mariner", "It is an ancient Mariner,", lines[0]);
View Full Code Here

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

            .setMappingDerivationStrategy(MappingDerivationStrategy.USE_BIND_TIME_TYPE);
        reader.getXMLIntrospector().getConfiguration()
      .setWrapCollectionsInElement(false);
        reader.getBindingConfiguration().setMapIDs(false);
       
        reader.registerBeanClass(Animals.class);
        Animals animals = (Animals) reader.parse(new StringReader(xml));
        assertEquals("Expexted three animals", 3, animals.size());
        Iterator it=animals.getAnimals();
        Animal animalOne = (Animal) it.next();
        assertTrue("Expected ferret", animalOne instanceof FerretBean);
View Full Code Here

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

//        log = new SimpleLog("[testSimpleRead:XMLIntrospector]");
//        log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
//        reader.getXMLIntrospector().setLog(log);
       
        reader.registerBeanClass( IDBean.class );

        InputStream in = new FileInputStream(
            getTestFile("src/test/org/apache/commons/betwixt/digester/SimpleReadTest.xml") );
           
        try {       
View Full Code Here

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

//
//        log = new SimpleLog("[testIDRead:XMLIntrospector]");
//        log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
//        reader.getXMLIntrospector().setLog(log);
       
        reader.registerBeanClass( IDBean.class );

        InputStream in = new FileInputStream(
            getTestFile("src/test/org/apache/commons/betwixt/digester/IDTest1.xml") );
           
        try {
View Full Code Here

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

            .setMappingDerivationStrategy(MappingDerivationStrategy.USE_INTROSPECTION_TIME_TYPE);
        reader.getXMLIntrospector().getConfiguration()
      .setWrapCollectionsInElement(false);
        reader.getBindingConfiguration().setMapIDs(false);
       
        reader.registerBeanClass(Animals.class);
        Animals animals = (Animals) reader.parse(new StringReader(xml));
        assertEquals("Expexted three animals", 3, animals.size());
        Iterator it=animals.getAnimals();
        Animal animalOne = (Animal) it.next();
        assertTrue("Expected ferret", animalOne instanceof FerretBean);
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.