Examples of enableJaxbAnnotation()


Examples of org.springside.modules.mapper.JsonMapper.enableJaxbAnnotation()

   * 测试直接使用Jaxb的annotaion
   */
  @Test
  public void jaxbAnnoation() {
    JsonMapper newMapper = new JsonMapper();
    newMapper.enableJaxbAnnotation();
    TestBean3 testBean = new TestBean3(1, "foo", 18);
    // 结果name属性输出在前,且被改名为productName,且age属性被ignore
    assertThat(newMapper.toJson(testBean)).isEqualTo("{\"productName\":\"foo\",\"id\":1}");
  }

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.