Examples of HyphenatedNameMapper


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

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

       
  }
   
    public void testOrderLine() throws Exception {
        SchemaTranscriber transcriber = new SchemaTranscriber();
        transcriber.getXMLIntrospector().getConfiguration().setAttributeNameMapper(new HyphenatedNameMapper());
        transcriber.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(true);
        Schema out = transcriber.generate(OrderLineBean.class);
       
        Schema expected = new Schema();
       
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 out = transcriber.generate(OrderBean.class);
       
        Schema expected = new Schema();
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

     * 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'?>");
       
        BeanWriter writer = new BeanWriter(out);
        XMLIntrospector introspector = writer.getXMLIntrospector();
        introspector.setElementNameMapper(new HyphenatedNameMapper());
        introspector.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

        StringWriter out = new StringWriter();
        out.write("<?xml version='1.0'?>");
       
        BeanWriter writer = new BeanWriter(out);
        XMLIntrospector introspector = writer.getXMLIntrospector();
        introspector.setElementNameMapper(new HyphenatedNameMapper());
        introspector.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.setElementNameMapper(new HyphenatedNameMapper());
        introspector.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().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.