Examples of DPerson


Examples of com.avaje.tests.model.ddd.DPerson

       
        GlobalProperties.put("classes", DPerson.class.toString());
       
        Currency NZD = Currency.getInstance("NZD");
       
        DPerson p = new DPerson();
        p.setFirstName("first");
        p.setLastName("last");
        p.setSalary(new Money("12200"));
        p.setCmoney(new CMoney(new Money("12"), NZD));
       
        SpiEbeanServer server = (SpiEbeanServer)Ebean.getServer(null);
       
        BeanDescriptor<DPerson> descriptor = server.getBeanDescriptor(DPerson.class);
       
        ElPropertyValue elCmoney = descriptor.getElGetValue("cmoney");
//        ElPropertyValue elCmoneyAmt = descriptor.getElGetValue("cmoney.amount");
//        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());
       
       
        EntityBean entityBean = (EntityBean)p;
       
        Object cmoney = elCmoney.elGetValue(entityBean);
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.