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);