1 16 package net.sf.dozer.util.mapping.factories; 17 18 import net.sf.dozer.util.mapping.vo.InsideTestObjectPrime; 19 import net.sf.dozer.util.mapping.vo.InsideTestObject; 20 21 24 public class SampleCustomBeanFactory2 extends BaseSampleBeanFactory { 25 26 public Object createBean(Object srcObj, Class srcObjClass, String id) { 27 30 if (!id.equals("someBeanId")) { 31 throw new IllegalArgumentException ("Unsupported bean id: " + id); 32 } 33 34 if (srcObj == null || srcObjClass == null) { 35 throw new IllegalArgumentException ("Source Object and Source Object Class params" + 36 " should have been provided by the Dozer mapping engine"); 37 } 38 39 InsideTestObjectPrime result = new InsideTestObjectPrime(); 40 result.setLabelPrime(((InsideTestObject) srcObj).getLabel()); 41 setCreatedByFactoryName(result, SampleCustomBeanFactory2.class.getName()); 44 45 return result; 46 } 47 48 49 } 50 | Popular Tags |