void evaluateSetters(InjectingComponentType componentType, Class<?> implClass, IntrospectionContext context) { Map<InjectionSite, Injectable> sites = componentType.getInjectionSites(); TypeMapping typeMapping = context.getTypeMapping(implClass); Set<Method> setters = helper.getInjectionMethods(implClass, componentType.getServices().values()); for (Method setter : setters) { InjectionSite site = new MethodInjectionSite(setter, 0); // skip sites that have already been mapped if (sites.containsKey(site)) { continue; } String name = helper.getSiteName(setter, null); Type parameterType = setter.getGenericParameterTypes()[0]; Annotation[] annotations = setter.getAnnotations(); processSite(componentType, typeMapping, name, setter, parameterType, site, annotations, context); } }
public JUnitImplementation load(XMLStreamReader reader, IntrospectionContext context) throws XMLStreamException { String className = reader.getAttributeValue(null, "class"); JUnitImplementation implementation = new JUnitImplementation(className); validateAttributes(reader, context, implementation); InjectingComponentType componentType = implementationProcessor.introspect(className, context); implementation.setComponentType(componentType); // Add a binding only on the JUnit service (which is the impl class) so wires are generated to the test operations. // These wires will be used by the testing runtime to dispatch to the JUnit components. ContextConfiguration configuration = loadConfiguration(reader, implementation, context); for (AbstractService serviceDefinition : implementation.getComponentType().getServices().values()) { if (serviceDefinition.getServiceContract().getQualifiedInterfaceName().equals(implementation.getImplementationClass())) { JUnitBindingDefinition bindingDefinition = new JUnitBindingDefinition(configuration); serviceDefinition.addBinding(bindingDefinition); break; } } return implementation; }