Package org.apache.commons.betwixt.strategy

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


        writer = new BeanWriter(out);
        writer.setWriteEmptyElements(true);
        writer.getXMLIntrospector().setWrapCollectionsInElement(true);
        writer.setWriteIDs(false);
        writer.getXMLIntrospector().setElementNameMapper(new CapitalizeNameMapper());
        writer.write("CarryOn", names);
       
        xml = "<?xml version='1.0'?><CarryOn><Names>"
         + "<Name><Name>Sid James</Name></Name>"
         + "<Name><Name>Kenneth Williams</Name></Name>"
         + "<Name><Name>Joan Simms</Name></Name>"
         + "<Name><Name>Charles Hawtrey</Name></Name>"
         + "</Names>"
         +"</CarryOn>";
        
        xmlAssertIsomorphicContent(
                            parseString(out.getBuffer().toString()),
                            parseString(xml),
                            true);
                           
        ArrayList things = new ArrayList();
        things.add(new NameBean("Sugar"));
        things.add(new NameBean("Spice"));
        things.add(new NameBean("All Things Nice"));
       
        NoAdderBean bean = new NoAdderBean();
        bean.setThings(things);
       
        out = new StringWriter();
        out.write("<?xml version='1.0'?>");
        writer = new BeanWriter(out);
        writer.setWriteEmptyElements(true);
        writer.getXMLIntrospector().setWrapCollectionsInElement(true);
        writer.setWriteIDs(false);
        writer.write(bean);
       
        xml = "<?xml version='1.0'?><NoAdderBean><things>"
         + "<NameBean><name>Sugar</name></NameBean>"
         + "<NameBean><name>Spice</name></NameBean>"
         + "<NameBean><name>All Things Nice</name></NameBean>"
         + "</things>"
         +"</NoAdderBean>";
        
        xmlAssertIsomorphicContent(
                            parseString(out.getBuffer().toString()),
                            parseString(xml),
                            true);
       
        out = new StringWriter();
        out.write("<?xml version='1.0'?>");
        writer = new BeanWriter(out);
        writer.setWriteEmptyElements(true);
        writer.getXMLIntrospector().setWrapCollectionsInElement(true);
        writer.setWriteIDs(false);
        writer.getXMLIntrospector().setElementNameMapper(new CapitalizeNameMapper());
        writer.write(bean);
       
        xml = "<?xml version='1.0'?><NoAdderBean><Things>"
         + "<NameBean><Name>Sugar</Name></NameBean>"
         + "<NameBean><Name>Spice</Name></NameBean>"
View Full Code Here


//        testLog.setLevel(SimpleLog.LOG_LEVEL_TRACE);
    }

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

        writer = new BeanWriter(out);
        writer.setWriteEmptyElements(true);
        writer.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(true);
        writer.getBindingConfiguration().setMapIDs(false);
        writer.getXMLIntrospector().getConfiguration().setElementNameMapper(new CapitalizeNameMapper());
        writer.write("CarryOn", names);
       
        xml = "<?xml version='1.0'?><CarryOn><Names>"
         + "<Name><Name>Sid James</Name></Name>"
         + "<Name><Name>Kenneth Williams</Name></Name>"
         + "<Name><Name>Joan Simms</Name></Name>"
         + "<Name><Name>Charles Hawtrey</Name></Name>"
         + "</Names>"
         +"</CarryOn>";
        
        xmlAssertIsomorphicContent(
                            parseString(out.getBuffer().toString()),
                            parseString(xml),
                            true);
                           
        ArrayList things = new ArrayList();
        things.add(new NameBean("Sugar"));
        things.add(new NameBean("Spice"));
        things.add(new NameBean("All Things Nice"));
       
        NoAdderBean bean = new NoAdderBean();
        bean.setThings(things);
       
        out = new StringWriter();
        out.write("<?xml version='1.0'?>");
        writer = new BeanWriter(out);
        writer.setWriteEmptyElements(true);
        writer.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(true);
        writer.getBindingConfiguration().setMapIDs(false);
        writer.write(bean);
       
        xml = "<?xml version='1.0'?><NoAdderBean><things>"
         + "<NameBean><name>Sugar</name></NameBean>"
         + "<NameBean><name>Spice</name></NameBean>"
         + "<NameBean><name>All Things Nice</name></NameBean>"
         + "</things>"
         +"</NoAdderBean>";
        
        xmlAssertIsomorphicContent(
                            parseString(out.getBuffer().toString()),
                            parseString(xml),
                            true);
       
        out = new StringWriter();
        out.write("<?xml version='1.0'?>");
        writer = new BeanWriter(out);
        writer.setWriteEmptyElements(true);
        writer.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(true);
        writer.getBindingConfiguration().setMapIDs(false);
        writer.getXMLIntrospector().getConfiguration().setElementNameMapper(new CapitalizeNameMapper());
        writer.write(bean);
       
        xml = "<?xml version='1.0'?><NoAdderBean><Things>"
         + "<NameBean><Name>Sugar</Name></NameBean>"
         + "<NameBean><Name>Spice</Name></NameBean>"
View Full Code Here

    private BindingConfiguration noIDsBindingConfiguration = new BindingConfiguration();
   
    public TestCollectives(String testName) {
        super(testName);
       
        CapitalizeNameMapper capitalizeNameMapper = new CapitalizeNameMapper();
        categoriesIntrospectionConfiguration.setAttributesForPrimitives(false);
        categoriesIntrospectionConfiguration.setElementNameMapper(capitalizeNameMapper);
        categoriesIntrospectionConfiguration.setAttributeNameMapper(capitalizeNameMapper);
        categoriesIntrospectionConfiguration.setWrapCollectionsInElement(false);   
       
View Full Code Here

//        testLog.setLevel(SimpleLog.LOG_LEVEL_TRACE);
    }

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

    protected static NameMapper createNameMapper(String name) {
        if ( name.equalsIgnoreCase( "lowercase" ) ) {
            return new DecapitalizeNameMapper();
        }
        else if ( name.equalsIgnoreCase( "uppercase" ) ) {
            return new CapitalizeNameMapper();
        }
        else if ( name.equalsIgnoreCase( "hyphenated" ) ) {
            return new HyphenatedNameMapper();
        }
        else {
View Full Code Here

        writer = new BeanWriter(out);
        writer.setWriteEmptyElements(true);
        writer.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(true);
        writer.getBindingConfiguration().setMapIDs(false);
        writer.getXMLIntrospector().getConfiguration().setElementNameMapper(new CapitalizeNameMapper());
        writer.write("CarryOn", names);
       
        xml = "<?xml version='1.0'?><CarryOn><Names>"
         + "<Name><Name>Sid James</Name></Name>"
         + "<Name><Name>Kenneth Williams</Name></Name>"
         + "<Name><Name>Joan Simms</Name></Name>"
         + "<Name><Name>Charles Hawtrey</Name></Name>"
         + "</Names>"
         +"</CarryOn>";
        
        xmlAssertIsomorphicContent(
                            parseString(out.getBuffer().toString()),
                            parseString(xml),
                            true);
                           
        ArrayList things = new ArrayList();
        things.add(new NameBean("Sugar"));
        things.add(new NameBean("Spice"));
        things.add(new NameBean("All Things Nice"));
       
        NoAdderBean bean = new NoAdderBean();
        bean.setThings(things);
       
        out = new StringWriter();
        out.write("<?xml version='1.0'?>");
        writer = new BeanWriter(out);
        writer.setWriteEmptyElements(true);
        writer.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(true);
        writer.getBindingConfiguration().setMapIDs(false);
        writer.write(bean);
       
        xml = "<?xml version='1.0'?><NoAdderBean><things>"
         + "<NameBean><name>Sugar</name></NameBean>"
         + "<NameBean><name>Spice</name></NameBean>"
         + "<NameBean><name>All Things Nice</name></NameBean>"
         + "</things>"
         +"</NoAdderBean>";
        
        xmlAssertIsomorphicContent(
                            parseString(out.getBuffer().toString()),
                            parseString(xml),
                            true);
       
        out = new StringWriter();
        out.write("<?xml version='1.0'?>");
        writer = new BeanWriter(out);
        writer.setWriteEmptyElements(true);
        writer.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(true);
        writer.getBindingConfiguration().setMapIDs(false);
        writer.getXMLIntrospector().getConfiguration().setElementNameMapper(new CapitalizeNameMapper());
        writer.write(bean);
       
        xml = "<?xml version='1.0'?><NoAdderBean><Things>"
         + "<NameBean><Name>Sugar</Name></NameBean>"
         + "<NameBean><Name>Spice</Name></NameBean>"
View Full Code Here

    private BindingConfiguration noIDsBindingConfiguration = new BindingConfiguration();
   
    public TestCollectives(String testName) {
        super(testName);
       
        CapitalizeNameMapper capitalizeNameMapper = new CapitalizeNameMapper();
        categoriesIntrospectionConfiguration.setAttributesForPrimitives(false);
        categoriesIntrospectionConfiguration.setElementNameMapper(capitalizeNameMapper);
        categoriesIntrospectionConfiguration.setAttributeNameMapper(capitalizeNameMapper);
        categoriesIntrospectionConfiguration.setWrapCollectionsInElement(false);   
       
View Full Code Here

//        testLog.setLevel(SimpleLog.LOG_LEVEL_TRACE);
    }

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

        writer = new BeanWriter(out);
        writer.setWriteEmptyElements(true);
        writer.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(true);
        writer.getBindingConfiguration().setMapIDs(false);
        writer.getXMLIntrospector().getConfiguration().setElementNameMapper(new CapitalizeNameMapper());
        writer.write("CarryOn", names);
       
        xml = "<?xml version='1.0'?><CarryOn><Names>"
         + "<Name><Name>Sid James</Name></Name>"
         + "<Name><Name>Kenneth Williams</Name></Name>"
         + "<Name><Name>Joan Simms</Name></Name>"
         + "<Name><Name>Charles Hawtrey</Name></Name>"
         + "</Names>"
         +"</CarryOn>";
        
        xmlAssertIsomorphicContent(
                            parseString(out.getBuffer().toString()),
                            parseString(xml),
                            true);
                           
        ArrayList things = new ArrayList();
        things.add(new NameBean("Sugar"));
        things.add(new NameBean("Spice"));
        things.add(new NameBean("All Things Nice"));
       
        NoAdderBean bean = new NoAdderBean();
        bean.setThings(things);
       
        out = new StringWriter();
        out.write("<?xml version='1.0'?>");
        writer = new BeanWriter(out);
        writer.setWriteEmptyElements(true);
        writer.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(true);
        writer.getBindingConfiguration().setMapIDs(false);
        writer.write(bean);
       
        xml = "<?xml version='1.0'?><NoAdderBean><things>"
         + "<NameBean><name>Sugar</name></NameBean>"
         + "<NameBean><name>Spice</name></NameBean>"
         + "<NameBean><name>All Things Nice</name></NameBean>"
         + "</things>"
         +"</NoAdderBean>";
        
        xmlAssertIsomorphicContent(
                            parseString(out.getBuffer().toString()),
                            parseString(xml),
                            true);
       
        out = new StringWriter();
        out.write("<?xml version='1.0'?>");
        writer = new BeanWriter(out);
        writer.setWriteEmptyElements(true);
        writer.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(true);
        writer.getBindingConfiguration().setMapIDs(false);
        writer.getXMLIntrospector().getConfiguration().setElementNameMapper(new CapitalizeNameMapper());
        writer.write(bean);
       
        xml = "<?xml version='1.0'?><NoAdderBean><Things>"
         + "<NameBean><Name>Sugar</Name></NameBean>"
         + "<NameBean><Name>Spice</Name></NameBean>"
View Full Code Here

TOP

Related Classes of org.apache.commons.betwixt.strategy.CapitalizeNameMapper

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.