Package jodd.json.meta

Examples of jodd.json.meta.JsonAnnotationManager


  }

  @Test
  public void testStrictMode() {
    Cook cook = new Cook();
    JsonAnnotationManager jam = JoddJson.annotationManager;

    JsonAnnotationManager.TypeData typeData = jam.lookupTypeData(Cook.class);

    assertEquals(1, typeData.rules.totalIncludeRules());
    assertEquals(1, typeData.rules.totalExcludeRules());

    assertEquals("ccc", typeData.rules.getRule(0));
    assertEquals("bbb", typeData.rules.getRule(1));

    JsonSerializer jsonSerializer = new JsonSerializer();

    String json = jsonSerializer.serialize(cook);

    assertTrue(json.contains("\"aaa\""));
    assertFalse(json.contains("\"bbb\""));
    assertTrue(json.contains("\"ccc\""));

    // now, strict = true, serialize only annotated properties!

    MasterCook masterCook = new MasterCook();

    typeData = jam.lookupTypeData(MasterCook.class);

    assertEquals(1, typeData.rules.totalIncludeRules());
    assertEquals(1, typeData.rules.totalExcludeRules());

    assertEquals("ccc", typeData.rules.getRule(0));
View Full Code Here

TOP

Related Classes of jodd.json.meta.JsonAnnotationManager

Copyright © 2018 www.massapicom. 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.