Examples of HyphenatedNameMapper


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

            + "</example-bean>";
       
       
        BeanReader reader = new BeanReader();
        //reader.setLog(log);
        reader.getXMLIntrospector().setElementNameMapper(new HyphenatedNameMapper());
        reader.getXMLIntrospector().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

        out.write("<?xml version='1.0'?>");
        writer = new BeanWriter(out);
        writer.setWriteEmptyElements(true);
        writer.getXMLIntrospector().setWrapCollectionsInElement(true);
        writer.setWriteIDs(false);
        writer.getXMLIntrospector().setElementNameMapper(new HyphenatedNameMapper(false));
        writer.write(bean);
       
        xml = "<?xml version='1.0'?><no-adder-bean><things>"
         + "<name-bean><name>Sugar</name></name-bean>"
         + "<name-bean><name>Spice</name></name-bean>"
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.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.setAttributeNameMapper(new DecapitalizeNameMapper());
View Full Code Here

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

     * mapper is set.
     */
    public void testCreateDescriptorWithHyphenatedElementNameMapper() throws Exception {
        XMLIntrospector introspector = new XMLIntrospector();
        introspector.setAttributesForPrimitives(false);
        introspector.setElementNameMapper(new HyphenatedNameMapper());
        BeanInfo beanInfo = Introspector.getBeanInfo(CustomerBean.class);

        NodeDescriptor nickNameProperty = createDescriptor("nickName", beanInfo, introspector);
        assertNotNull("nickName property not found", nickNameProperty);
        assertEquals("nick name property", "nick-name", nickNameProperty.getLocalName());
View Full Code Here

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

       
        StringWriter out = new StringWriter();
        out.write("<?xml version='1.0' encoding='UTF-8'?>");
       
        BeanWriter writer = new BeanWriter( out );
        writer.getXMLIntrospector().setElementNameMapper(new HyphenatedNameMapper());
        writer.getXMLIntrospector().setWrapCollectionsInElement(false);
       
        writer.write( bean );
       
        String xml = "<?xml version='1.0' encoding='UTF-8'?>"
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.setElementNameMapper(new HyphenatedNameMapper());

        return introspector;
    }
View Full Code Here

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

     * mapper is set.
     */
    public void testCreateDescriptorWithHyphenatedElementNameMapper() throws Exception {
        XMLIntrospector introspector = new XMLIntrospector();
        introspector.getConfiguration().setAttributesForPrimitives(false);
        introspector.getConfiguration().setElementNameMapper(new HyphenatedNameMapper());
        BeanInfo beanInfo = Introspector.getBeanInfo(CustomerBean.class);

        NodeDescriptor nickNameProperty = createDescriptor("nickName", beanInfo, introspector);
        assertNotNull("nickName property not found", nickNameProperty);
        assertEquals("nick name property", "nick-name", nickNameProperty.getLocalName());
View Full Code Here

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

        StringWriter out = new StringWriter();
        out.write("<?xml version='1.0' encoding='UTF-8'?>");
       
        BeanWriter writer = new BeanWriter( out );
    writer.getBindingConfiguration().setMapIDs(false);
        writer.getXMLIntrospector().getConfiguration().setElementNameMapper(new HyphenatedNameMapper());
        writer.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(false);
       
        writer.write( bean );
       
        String xml = "<?xml version='1.0' encoding='UTF-8'?>"
View Full Code Here

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

        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 HyphenatedNameMapper(false));
        writer.write(bean);
       
        xml = "<?xml version='1.0'?><no-adder-bean><things>"
         + "<name-bean><name>Sugar</name></name-bean>"
         + "<name-bean><name>Spice</name></name-bean>"
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.