Examples of HyphenatedNameMapper


Examples of org.apache.commons.betwixt.strategy.HyphenatedNameMapper

            + "<example><id>3</id><name>Dormouse</name></example>"
            + "</example-bean>";
       
       
        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 );
View Full Code Here

Examples of org.apache.commons.betwixt.strategy.HyphenatedNameMapper

        // wrap collections in an XML element
        //introspector.setWrapCollectionsInElement(true);

        // turn bean elements into lower case
        introspector.getConfiguration().setElementNameMapper(new HyphenatedNameMapper());

        return introspector;
    }
View Full Code Here

Examples of org.apache.commons.betwixt.strategy.HyphenatedNameMapper

        doTest(new DefaultNameMapper(), "default name mapper");
    }

    public void testHyphenatedNameMapper() throws Exception {
//        testLog.debug("Testing hyphenated name mapper");
        doTest(new HyphenatedNameMapper(), "hyphenated name mapper");
    }
View Full Code Here

Examples of org.apache.commons.betwixt.strategy.HyphenatedNameMapper

        // Since we want the names to resolve from eg PhysicalSchema
        // to PHYSICAL_SCHEMA.
        // we pass to the mapper we want uppercase and use _ for name
        // seperation.
        // This will set our ElementMapper.
        introspector.getConfiguration().setElementNameMapper(new HyphenatedNameMapper(true, "_"));
        // since our attribute names will use a different
        // naming convention in our xml file (just all lowercase)
        // we set another mapper for the attributes
        introspector.getConfiguration().setAttributeNameMapper(new DecapitalizeNameMapper());
View Full Code Here

Examples of org.apache.commons.betwixt.strategy.HyphenatedNameMapper

   
   
    public void testOrderLineBean() throws Exception {
        SchemaTranscriber transcriber = new SchemaTranscriber();
        transcriber.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(true);
        transcriber.getXMLIntrospector().getConfiguration().setAttributeNameMapper(new HyphenatedNameMapper());
        Schema schema = transcriber.generate(OrderLineBean.class);
       
        StringWriter out = new StringWriter();
        out.write("<?xml version='1.0'?>");
        BeanWriter writer = new BeanWriter(out);
View Full Code Here

Examples of org.apache.commons.betwixt.strategy.HyphenatedNameMapper

    }
   
    public void testOrder() throws Exception {
        SchemaTranscriber transcriber = new SchemaTranscriber();
        transcriber.getXMLIntrospector().getConfiguration()
                .setElementNameMapper(new HyphenatedNameMapper());
        transcriber.getXMLIntrospector().getConfiguration()
                .setAttributeNameMapper(new HyphenatedNameMapper());
        transcriber.getXMLIntrospector().getConfiguration()
                .setAttributesForPrimitives(true);
        transcriber.getXMLIntrospector().getConfiguration()
                .setWrapCollectionsInElement(false);
        Schema schema = transcriber.generate(OrderBean.class);
View Full Code Here

Examples of org.apache.commons.betwixt.strategy.HyphenatedNameMapper

        out.write("<?xml version='1.0'?>");
       
        BeanWriter writer = new BeanWriter(out);
    writer.getBindingConfiguration().setMapIDs(false);
        XMLIntrospector introspector = writer.getXMLIntrospector();
        introspector.getConfiguration().setElementNameMapper(new HyphenatedNameMapper());
        introspector.getConfiguration().setAttributesForPrimitives(false);
       
        writer.write("party", bean);

        String xml = "<?xml version='1.0'?><party>"
View Full Code Here

Examples of org.apache.commons.betwixt.strategy.HyphenatedNameMapper

        out.write("<?xml version='1.0'?>");
       
        BeanWriter writer = new BeanWriter(out);
    writer.getBindingConfiguration().setMapIDs(false);
        XMLIntrospector introspector = writer.getXMLIntrospector();
        introspector.getConfiguration().setElementNameMapper(new HyphenatedNameMapper());
        introspector.getConfiguration().setAttributesForPrimitives(false);
       
        writer.write(bean);
       
        String xml = "<?xml version='1.0'?><party-bean>"
View Full Code Here

Examples of org.apache.commons.betwixt.strategy.HyphenatedNameMapper

        out.write("<?xml version='1.0'?>");
       
        BeanWriter writer = new BeanWriter(out);
        writer.setBindingConfiguration(configuration);
        XMLIntrospector introspector = writer.getXMLIntrospector();
        introspector.getConfiguration().setElementNameMapper(new HyphenatedNameMapper());
        introspector.getConfiguration().setAttributesForPrimitives(false);
       
        writer.write("party", bean);

        String xml = "<?xml version='1.0'?><party>"
View Full Code Here

Examples of org.apache.commons.betwixt.strategy.HyphenatedNameMapper

                    + "<CHILD><NAME>Poseidon</NAME></CHILD>"
                    + "<CHILD><NAME>Zeus</NAME></CHILD>"
                    + "</CHILDREN></DOUBLE_LINKED_PARENT_BEAN>";
                   
        BeanReader reader = new BeanReader();
        reader.getXMLIntrospector().getConfiguration().setElementNameMapper(new HyphenatedNameMapper(true, "_"));
        reader.registerBeanClass(DoubleLinkedParentBean.class);
        DoubleLinkedParentBean bean = (DoubleLinkedParentBean) reader.parse(new StringReader(xml));
       
        assertNotNull("Bean read", bean);
        assertEquals("Cronus", "Parent name", bean.getName());
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.