Examples of HyphenatedNameMapper


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

    }
  
    private String generateOrderLineSchema() 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

       String xsd = generateOrderLineSchema();
       StringWriter out = new StringWriter();
       out.write("<?xml version='1.0'?>");
       BeanWriter writer = new BeanWriter(out);
       writer.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(true);
       writer.getXMLIntrospector().getConfiguration().setAttributeNameMapper(new HyphenatedNameMapper());
       writer.getXMLIntrospector().getConfiguration().getPrefixMapper().setPrefix(SchemaTranscriber.W3C_SCHEMA_INSTANCE_URI, "xsi");
       writer.getBindingConfiguration().setMapIDs(false);
       OrderLineBean bean = new OrderLineBean(3, new ProductBean("00112234", "A11", "Fat Fish", "A Fat Fish"));
       writer.write(bean);
      
View Full Code Here

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

       xmlAssertIsValid(new InputSource(new StringReader(xml)), new InputSource(new StringReader(xsd)));
    }     
   
    private String generateOrderSchema() 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);
       
        StringWriter out = new StringWriter();
View Full Code Here

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

    public void testOrder() throws Exception {
        String xsd = generateOrderSchema();
        StringWriter out = new StringWriter();
        out.write("<?xml version='1.0'?>");
        BeanWriter writer = new BeanWriter(out);
        writer.getXMLIntrospector().getConfiguration().setElementNameMapper(new HyphenatedNameMapper());
        writer.getXMLIntrospector().getConfiguration().setAttributeNameMapper(new HyphenatedNameMapper());
        writer.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(true);
        writer.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(false);
        writer.getBindingConfiguration().setMapIDs(false);
       
        OrderBean bean = new OrderBean("XA-2231",
View Full Code Here

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

    {
        BeanReader reader = new BeanReader();

        reader.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(true);
        reader.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(false);
        reader.getXMLIntrospector().getConfiguration().setElementNameMapper(new HyphenatedNameMapper());
        reader.setValidating(isValidateXml());
        if (isUseInternalDtd())
        {
            reader.setEntityResolver(new LocalEntityResolver());
        }
View Full Code Here

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

            BeanWriter writer = new BeanWriter(output);
   
            writer.getXMLIntrospector().register(getBetwixtMapping());
            writer.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(true);
            writer.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(false);
            writer.getXMLIntrospector().getConfiguration().setElementNameMapper(new HyphenatedNameMapper());
            writer.getBindingConfiguration().setMapIDs(false);
            writer.enablePrettyPrint();
   
            return writer;
        }
View Full Code Here

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

        }
        else if ( name.equalsIgnoreCase( "uppercase" ) ) {
            return new CapitalizeNameMapper();
        }
        else if ( name.equalsIgnoreCase( "hyphenated" ) ) {
            return new HyphenatedNameMapper();
        }
        else {
            // lets try load the class of this name
            Class theClass = null;
            try {
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
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.