Package com.avaje.ebean.text.json

Examples of com.avaje.ebean.text.json.JsonContext.toList()



    String s = json.toJson(list);
    System.out.println(s);

    List<Customer> mList = json.toList(Customer.class, s);
    System.out.println("VIA STRING: " + mList);

    StringReader reader = new StringReader(s);
    List<Customer> mList2 = json.toList(Customer.class, reader);
    System.out.println("VIA READER: " + mList2);
View Full Code Here


    List<Customer> mList = json.toList(Customer.class, s);
    System.out.println("VIA STRING: " + mList);

    StringReader reader = new StringReader(s);
    List<Customer> mList2 = json.toList(Customer.class, reader);
    System.out.println("VIA READER: " + mList2);

    Assert.assertEquals(mList.size(), mList2.size());
  }
View Full Code Here

    List<Animal> animals = Ebean.find(Animal.class).findList();

    String listJson = json.toJson(animals);

    List<Animal> animals2 = json.toList(Animal.class, listJson);
    Assert.assertEquals(animals.size(), animals2.size());

    String noDiscList = "[{\"id\":1,\"name\":\"Gemma\",\"version\":1},{\"name\":\"PussCat\",\"version\":1},{\"species\":\"CAT\",\"name\":\"PussCat\",\"version\":1}]";
    List<Cat> cats = json.toList(Cat.class, noDiscList);
    Assert.assertEquals(cats.size(), 3);
View Full Code Here

    List<Animal> animals2 = json.toList(Animal.class, listJson);
    Assert.assertEquals(animals.size(), animals2.size());

    String noDiscList = "[{\"id\":1,\"name\":\"Gemma\",\"version\":1},{\"name\":\"PussCat\",\"version\":1},{\"species\":\"CAT\",\"name\":\"PussCat\",\"version\":1}]";
    List<Cat> cats = json.toList(Cat.class, noDiscList);
    Assert.assertEquals(cats.size(), 3);

  }

}
View Full Code Here

    JsonContext json = server.json();

    String jsonOutput = json.toJson(list);
    System.out.println(jsonOutput);

    List<Customer> mList = json.toList(Customer.class, jsonOutput);

    Assert.assertEquals(list.size(), mList.size());
  }
}
View Full Code Here

    JsonContext jsonContext = Ebean.json();
    String jsonString = jsonContext.toJson(list);
    System.out.println(jsonString);

    List<Vehicle> rebuiltList = jsonContext.toList(Vehicle.class, jsonString);

    Assert.assertEquals(2, rebuiltList.size());

  }
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.