@Test public void testRegen() throws ClassNotFoundException, IllegalAccessException, InstantiationException { Dummy d = t.getDummy(); int index = d.getIndex(); Dummy d1 = AssociationProxyUtil.regenProxy(t.getDummy()); Assert.assertEquals(index, d1.getIndex()); }
public static <T> T regenProxy(T proxy) throws ClassNotFoundException, InstantiationException, IllegalAccessException { T newProxy = null; if(proxy instanceof AssociationProxy) { AssociationProxy<T> aProxy = (AssociationProxy)proxy; Association<T> association = aProxy.getAssociation(); String proxyClass = association.getAssociationDescriptor().getProxyClass(); proxyClass = (proxyClass==null? AssociationProxySupport.class.getName() : proxyClass); String strategyClass = aProxy.getServiceSelectionStrategy().getClass().getName(); newProxy = (T) AssociationProxyFactory.createProxy(proxyClass, strategyClass, association, aProxy.getClass().getClassLoader()); aProxy.terminate(); } return newProxy==null?proxy:newProxy; }
AssociationProxyUtil { public static <T> T regenProxy(T proxy) throws ClassNotFoundException, InstantiationException, IllegalAccessException { T newProxy = null; if(proxy instanceof AssociationProxy) { AssociationProxy<T> aProxy = (AssociationProxy)proxy; Association<T> association = aProxy.getAssociation(); String proxyClass = association.getAssociationDescriptor().getProxyClass(); proxyClass = (proxyClass==null? AssociationProxySupport.class.getName() : proxyClass); String strategyClass = aProxy.getServiceSelectionStrategy().getClass().getName(); newProxy = (T) AssociationProxyFactory.createProxy(proxyClass, strategyClass, association, aProxy.getClass().getClassLoader()); aProxy.terminate(); } return newProxy==null?proxy:newProxy; } }
AssociationProxyUtil { public static <T> T regenProxy(T proxy) throws ClassNotFoundException, InstantiationException, IllegalAccessException { T newProxy = null; if(proxy instanceof AssociationProxy) { AssociationProxy<T> aProxy = (AssociationProxy)proxy; Association<T> association = aProxy.getAssociation(); String proxyClass = association.getAssociationDescriptor().getProxyClass(); proxyClass = (proxyClass==null? AssociationProxySupport.class.getName() : proxyClass); String strategyClass = aProxy.getServiceSelectionStrategy().getClass().getName(); newProxy = (T) AssociationProxyFactory.createProxy(proxyClass, strategyClass, association, aProxy.getClass().getClassLoader()); aProxy.terminate(); } return newProxy==null?proxy:newProxy; }  }
AssociationProxyUtil { public static <T> T regenProxy(T proxy) throws ClassNotFoundException, InstantiationException, IllegalAccessException { T newProxy = null; if(proxy instanceof AssociationProxy) { AssociationProxy<T> aProxy = (AssociationProxy)proxy; Association<T> association = aProxy.getAssociation(); String proxyClass = association.getAssociationDescriptor().getProxyClass(); proxyClass = (proxyClass==null? AssociationProxySupport.class.getName() : proxyClass); String strategyClass = aProxy.getServiceSelectionStrategy().getClass().getName(); newProxy = (T) AssociationProxyFactory.createProxy(proxyClass, strategyClass, association, aProxy.getClass().getClassLoader()); aProxy.terminate(); } return newProxy==null?proxy:newProxy; }  static T getService(T proxy); static T regenProxy(T proxy); static T getFirst(T proxy); static Association<T> getAssociation(T proxy); }
AssociationProxyUtil { public static <T> T regenProxy(T proxy) throws ClassNotFoundException, InstantiationException, IllegalAccessException { T newProxy = null; if(proxy instanceof AssociationProxy) { AssociationProxy<T> aProxy = (AssociationProxy)proxy; Association<T> association = aProxy.getAssociation(); String proxyClass = association.getAssociationDescriptor().getProxyClass(); proxyClass = (proxyClass==null? AssociationProxySupport.class.getName() : proxyClass); String strategyClass = aProxy.getServiceSelectionStrategy().getClass().getName(); newProxy = (T) AssociationProxyFactory.createProxy(proxyClass, strategyClass, association, aProxy.getClass().getClassLoader()); aProxy.terminate(); } return newProxy==null?proxy:newProxy; }  static T getService(T proxy); static T regenProxy(T proxy); static T getFirst(T proxy); static Association<T> getAssociation(T proxy);  }