Examples of toBean()


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

//        ElPropertyValue elCmoneyCur = descriptor.getElGetValue("cmoney.currency");
       
        JsonContext jsonContext = server.json();
        String json = jsonContext.toJson(p);
       
        DPerson bean = jsonContext.toBean(DPerson.class, json);
        Assert.assertEquals("first", bean.getFirstName());
        Assert.assertEquals(new Money("12200"), bean.getSalary());
        Assert.assertEquals(new Money("12"), bean.getCmoney().getAmount());
        Assert.assertEquals(NZD, bean.getCmoney().getCurrency());
       
View Full Code Here

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

    System.out.println(jsonString);
    jsonString = jsonString.replace("twoName", "twoNameModified");
    jsonString = jsonString.replace("oneName", "oneNameModified");
   
   
    UUTwo two2 = jsonContext.toBean(UUTwo.class, jsonString);
   
    Assert.assertEquals(twoX.getId(), two2.getId());
    Assert.assertEquals("twoNameModified", two2.getName());
    Assert.assertEquals("oneNameModified", two2.getMaster().getName());
View Full Code Here

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

    bean.setSomeEnum(SomeEnum.ALPHA);

    JsonContext json = Ebean.json();
    String jsonContent = json.toJson(bean);

    SomeEnumBean bean2 = json.toBean(SomeEnumBean.class, jsonContent);

    Assert.assertEquals(bean.getSomeEnum(), bean2.getSomeEnum());
    Assert.assertEquals(bean.getName(), bean2.getName());
    Assert.assertEquals(bean.getId(), bean2.getId());
View Full Code Here

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

    JsonContext jsonContext = server.json();
    String jsonString = jsonContext.toJson(order);
    System.out.println(jsonString);

    Order updOrder = jsonContext.toBean(Order.class, jsonString);

    server.update(updOrder);

    MRole r1 = new MRole();
    r1.setRoleName("rolej1");
View Full Code Here

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

    String s = "{\"userid\":" + u0.getUserid()
        + ",\"userName\":\"userj1\", \"roles\":[{\"roleid\":" + r2.getRoleid() + "},{\"roleid\":"
        + r3.getRoleid() + "}]} ";

    MUser updMUser = jsonContext.toBean(MUser.class, s);

    server.update(updMUser);

    // checked transaction log to confirm correct behaviour
  }
View Full Code Here

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

    String json0 = "{\"name\":\"InsJson\",\"status\":\"NEW\"}";

    JsonContext jsonContext = Ebean.json();

    // insert
    Customer c0 = jsonContext.toBean(Customer.class, json0);
    Ebean.save(c0);

    // update with optimistic concurrency checking
    String j0 = jsonContext.toJson(c0);
    String j1 = StringHelper.replaceString(j0, "InsJson", "Mod1");
View Full Code Here

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

    Ebean.save(c0);

    // update with optimistic concurrency checking
    String j0 = jsonContext.toJson(c0);
    String j1 = StringHelper.replaceString(j0, "InsJson", "Mod1");
    Customer c1 = jsonContext.toBean(Customer.class, j1);
    Ebean.update(c1);

    // update with no optimistic concurrency checking
    String j2 = "{\"id\":" + c0.getId() + ",\"name\":\"ModIns\",\"status\":\"ACTIVE\"}";
    Customer c2 = jsonContext.toBean(Customer.class, j2);
View Full Code Here

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

    Customer c1 = jsonContext.toBean(Customer.class, j1);
    Ebean.update(c1);

    // update with no optimistic concurrency checking
    String j2 = "{\"id\":" + c0.getId() + ",\"name\":\"ModIns\",\"status\":\"ACTIVE\"}";
    Customer c2 = jsonContext.toBean(Customer.class, j2);
    Ebean.update(c2);

  }
}
View Full Code Here

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

    Ebean.save(cat);

    JsonContext json = Ebean.json();
    String jsonContent = json.toJson(cat);

    Cat cat2 = json.toBean(Cat.class, jsonContent);

    Assert.assertEquals(cat.getId(), cat2.getId());
    Assert.assertEquals(cat.getName(), cat2.getName());
    Assert.assertEquals(cat.getVersion(), cat2.getVersion());
View Full Code Here

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

    Assert.assertEquals(cat.getName(), cat2.getName());
    Assert.assertEquals(cat.getVersion(), cat2.getVersion());

    String noDiscriminator = "{\"id\":1,\"name\":\"Gemma\",\"version\":1}";

    Cat cat3 = json.toBean(Cat.class, noDiscriminator);

    Assert.assertEquals(1L, cat3.getId().longValue());
    Assert.assertEquals("Gemma", cat3.getName());
    Assert.assertEquals(1L, cat3.getVersion().longValue());
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.