/** * this copy used introspection, you can override it in generated class * to optimize it * @param source */ @Override public void copyFrom(BusinessEntity source) { try { WikittyUtil.copyBean(source, this); } catch(Exception eee) { throw new WikittyException(String.format( "Can't copy source object %s", source), eee); } }
@Test public void testCopyBean() throws Exception { WikittyLabel source = new WikittyLabelImpl(); // version 0.1 (init) source.addLabels("toto"); // changes : new version is 0.2 WikittyLabel dest = new WikittyLabelImpl(); // version 0.1 (init) WikittyUtil.copyBean(source, dest); Assert.assertFalse(source.getWikittyId().equals(dest.getWikittyId())); Assert.assertEquals(source.getWikittyVersion(), dest.getWikittyVersion()); Assert.assertEquals(source.getLabels(), dest.getLabels()); }