@Test public void testInjectProxyWithListener() { Association<Dummy> a = new DefaultAssociation<Dummy>(createAssociationDescriptor()); Target1 t = new Target1(); AssociationInjector<Dummy> ai = new AssociationInjector<Dummy>(t); AL aL = new AL(); a.registerAssociationServiceListener(aL); for(int i=0; i<10; i++) { Dummy dummy = new DummyImpl(i); a.addServiceItem(AssociationUtils.makeServiceItem(dummy)); ai.discovered(a, dummy); } Assert.assertEquals(1, t.injectedCount); Assert.assertEquals(10, aL.addedServiceCount.get()); Assert.assertEquals(0, aL.removedServiceCount.get()); Collection<Dummy> dummies = a.getServices(); for(Dummy d: dummies) a.removeService(d); Assert.assertEquals(10, aL.removedServiceCount.get()); Assert.assertEquals(0, a.getServiceCount()); }
public void discovered(Association<T> association, T service) { inject(association, service); }
AssociationInjector implements AssociationListener<T> { public void discovered(Association<T> association, T service) { inject(association, service); } }
AssociationInjector implements AssociationListener<T> { public void discovered(Association<T> association, T service) { inject(association, service); } AssociationInjector(Object target); }
AssociationInjector implements AssociationListener<T> { public void discovered(Association<T> association, T service) { inject(association, service); } AssociationInjector(Object target); void setBackend(Object target); void setCallerClassLoader(ClassLoader callerCL); void terminate(); Map<AssociationDescriptor, Long> getInvocationMap(); void injectEmpty(Association<T> association); void discovered(Association<T> association, T service); void changed(Association<T> association, T service); void broken(Association<T> association, T service); }
AssociationInjector implements AssociationListener<T> { public void discovered(Association<T> association, T service) { inject(association, service); } AssociationInjector(Object target); void setBackend(Object target); void setCallerClassLoader(ClassLoader callerCL); void terminate(); Map<AssociationDescriptor, Long> getInvocationMap(); void injectEmpty(Association<T> association); void discovered(Association<T> association, T service); void changed(Association<T> association, T service); void broken(Association<T> association, T service);  }