Package net.buffalo.protocal.converters.map

Examples of net.buffalo.protocal.converters.map.ObjectConverter.marshal()


  public void testShouldSerializeParentClass() throws Exception {
    ObjectConverter os = new ObjectConverter();
    BirthdayPeople people = new BirthdayPeople();
    people.setBirthday(new Date());
    assertTrue(os.canConvert(BirthdayPeople.class));
    os.marshal(people, context, streamWriter);
    String output = stringWriter.getBuffer().toString();
    assertTrue(output.indexOf("date")>-1);
    assertTrue(output.indexOf("name") > -1);
    assertEquals(1, context.getObjects().size());
  }
View Full Code Here


    user.setRoles(new String[]{"SA", "Architect"});
   
    StringWriter stringWriter = new StringWriter();
    StreamWriter streamWriter = new FastStreamWriter(stringWriter);
    MarshallingContext context = new DefaultMarshallingContext(new DefaultConverterLookup(), streamWriter);
    converter.marshal(user, context, streamWriter);
    assertEquals("<map><type>net.buffalo.protocal.User</type><string>username</string><string>Michael</string>" +
        "<string>password</string><string>password</string><string>gendor</string><string>girl</string>" +
        "<string>interests</string><list><type>java.util.ArrayList</type><length>3</length>" +
        "<string>Football</string><string>Music</string><string>Cook</string></list><string>roles</string>" +
        "<list><type>[string</type><length>2</length><string>SA</string><string>Architect</string></list></map>",
View Full Code Here

    ObjectConverter os = new ObjectConverter();
    assertFalse(os.canConvert(null));
    People people = new People();
    assertTrue(os.canConvert(People.class));
   
    os.marshal(people, context, streamWriter);
    String string = "<map>" +
            "<type>net.buffalo.protocal.People</type>" +
            "<string>name</string>" +
            "<null></null>" +
            "<string>age</string>" +
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.