1 16 package com.jdon.bussinessproxy.target; 17 18 import com.jdon.bussinessproxy.TargetMetaDef; 19 import com.jdon.container.ContainerWrapper; 20 import com.jdon.container.finder.ContainerCallback; 21 import com.jdon.util.Debug; 22 23 27 public class POJOObjectFactory { 28 private final static String module = POJOObjectFactory.class.getName(); 29 30 private ContainerCallback containerCallback; 31 32 35 public POJOObjectFactory(ContainerCallback containerCallback) { 36 super(); 37 this.containerCallback = containerCallback; 38 } 39 40 public Object create(TargetMetaDef targetMetaDef) throws Exception { 41 Object o = null; 42 try{ 43 Debug.logVerbose("[JdonFramework] create new pojo Object for " + targetMetaDef.getName(), module); 44 ContainerWrapper containerWrapper = containerCallback.getContainerWrapper(); 45 o = containerWrapper.getComponentNewInstance(targetMetaDef.getName()); 46 Debug.logVerbose("[JdonFramework] create new pojo Object id " + o.hashCode(), module); 47 }catch(Exception ex){ 48 Debug.logError("[JdonFramework]create error: " + ex, module); 49 throw new Exception (ex); 50 }catch(Throwable tw){ 51 Debug.logError("[JdonFramework]create error: " + tw, module); 52 throw new Exception (tw); 53 } 54 return o; } 55 56 57 } 58 | Popular Tags |