private Callback createDefinition(String name, Type type, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { TypeMapping typeMapping = context.getTypeMapping(implClass); Class<?> baseType = helper.getBaseType(type, typeMapping); ServiceContract contract = contractProcessor.introspect(baseType, implClass, context, componentType); return new Callback(name, contract); }
private CallbackDefinition createDefinition(String name, Type type, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { TypeMapping typeMapping = context.getTypeMapping(implClass); Class<?> baseType = helper.getBaseType(type, typeMapping); ServiceContract contract = contractProcessor.introspect(baseType, implClass, context, componentType); return new CallbackDefinition(name, contract); }
public void visitField(Monitor annotation, Field field, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { String name = helper.getSiteName(field, null); Type genericType = field.getGenericType(); TypeMapping typeMapping = context.getTypeMapping(implClass); Class<?> type = helper.getBaseType(genericType, typeMapping); FieldInjectionSite site = new FieldInjectionSite(field); MonitorResourceReference resource = createDefinition(name, annotation, type, componentType, context); componentType.add(resource, site); }
public void visitField(Monitor annotation, Field field, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { String name = helper.getSiteName(field, null); Type genericType = field.getGenericType(); TypeMapping typeMapping = context.getTypeMapping(implClass); Class<?> type = helper.getBaseType(genericType, typeMapping); FieldInjectionSite site = new FieldInjectionSite(field); MonitorResourceReference resource = createDefinition(name, annotation, type, componentType, context); componentType.add(resource, site); }
public void visitField(Monitor annotation, Field field, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { String name = helper.getSiteName(field, null); Type genericType = field.getGenericType(); TypeMapping typeMapping = context.getTypeMapping(implClass); Class<?> type = helper.getBaseType(genericType, typeMapping); FieldInjectionSite site = new FieldInjectionSite(field); MonitorResourceReference resource = createDefinition(name, annotation, type, componentType, context); componentType.add(resource, site); }
private void evaluateSetters(InjectingComponentType componentType, Class<?> implClass, IntrospectionContext context) { Map<InjectionSite, Injectable> sites = componentType.getInjectionSites(); 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); TypeMapping typeMapping = context.getTypeMapping(implClass); Type genericType = setter.getGenericParameterTypes()[0]; Class<?> parameterType = helper.getBaseType(genericType, typeMapping); processSite(componentType, name, setter, parameterType, implClass, site, context); } }
private void evaluateFields(InjectingComponentType componentType, Class<?> implClass, IntrospectionContext context) { Map<InjectionSite, Injectable> sites = componentType.getInjectionSites(); Set<Field> fields = helper.getInjectionFields(implClass); for (Field field : fields) { InjectionSite site = new FieldInjectionSite(field); // skip sites that have already been mapped if (sites.containsKey(site)) { continue; } String name = helper.getSiteName(field, null); TypeMapping typeMapping = context.getTypeMapping(implClass); Class<?> parameterType = helper.getBaseType(field.getGenericType(), typeMapping); processSite(componentType, name, field, parameterType, implClass, site, context); } }
private Reference<ComponentType> createDefinition(String name, boolean required, Type type, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { TypeMapping typeMapping = context.getTypeMapping(implClass); Class<?> baseType = helper.getBaseType(type, typeMapping); ServiceContract contract = contractProcessor.introspect(baseType, implClass, context, componentType); Reference<ComponentType> definition = new Reference<>(name, contract); helper.processMultiplicity(definition, required, type, typeMapping); return definition; }
private void addReference(InjectingComponentType componentType, TypeMapping typeMapping, String name, Type parameterType, InjectionSite site, IntrospectionContext context) { Class<?> type = helper.getBaseType(parameterType, typeMapping); ServiceContract contract = contractProcessor.introspect(type, context, componentType); Reference<ComponentType> reference = new Reference<>(name, contract); helper.processMultiplicity(reference, false, parameterType, typeMapping); componentType.add(reference, site); } }
private void evaluateConstructor(InjectingComponentType componentType, Class<?> implClass, IntrospectionContext context) { Constructor<?> constructor = componentType.getConstructor(); if (constructor == null) { return; } Map<InjectionSite, Injectable> sites = componentType.getInjectionSites(); Type[] parameterTypes = constructor.getGenericParameterTypes(); for (int i = 0; i < parameterTypes.length; i++) { InjectionSite site = new ConstructorInjectionSite(constructor, i); // skip sites that have already been mapped if (sites.containsKey(site)) { continue; } TypeMapping typeMapping = context.getTypeMapping(implClass); Class<?> parameterType = helper.getBaseType(parameterTypes[i], typeMapping); String name = helper.getSiteName(constructor, i, null); processSite(componentType, name, constructor, parameterType, implClass, site, context); } }
public void visitMethod(Monitor annotation, Method method, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { String name = helper.getSiteName(method, null); TypeMapping typeMapping = context.getTypeMapping(implClass); Type genericType = helper.getGenericType(method); Class<?> type = helper.getBaseType(genericType, typeMapping); MethodInjectionSite site = new MethodInjectionSite(method, 0); MonitorResourceReference resource = createDefinition(name, annotation, type, componentType, context); componentType.add(resource, site); }
public void visitMethod(Monitor annotation, Method method, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { String name = helper.getSiteName(method, null); TypeMapping typeMapping = context.getTypeMapping(implClass); Type genericType = helper.getGenericType(method); Class<?> type = helper.getBaseType(genericType, typeMapping); MethodInjectionSite site = new MethodInjectionSite(method, 0); MonitorResourceReference resource = createDefinition(name, annotation, type, componentType, context); componentType.add(resource, site); }
public void visitMethod(Monitor annotation, Method method, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { String name = helper.getSiteName(method, null); TypeMapping typeMapping = context.getTypeMapping(implClass); Type genericType = helper.getGenericType(method); Class<?> type = helper.getBaseType(genericType, typeMapping); MethodInjectionSite site = new MethodInjectionSite(method, 0); MonitorResourceReference resource = createDefinition(name, annotation, type, componentType, context); componentType.add(resource, site); }
protected ProducerDefinition createDefinition(String name, Type type, Class<?> implClass, InjectingComponentType componentType, Member member, IntrospectionContext context) { TypeMapping typeMapping = context.getTypeMapping(implClass); Class<?> baseType = helper.getBaseType(type, typeMapping); ServiceContract contract = contractProcessor.introspect(baseType, implClass, context, componentType); if (contract.getOperations().size() != 1) { String interfaceName = contract.getInterfaceName(); InvalidProducerInterface error = new InvalidProducerInterface("Producer interfaces must have one method: " + interfaceName, member, componentType); context.addError(error); } // TODO handle policies return new ProducerDefinition(name, contract); }
private Producer<ComponentType> createProducer(String name, Type type, Class<?> implClass, InjectingComponentType componentType, Member member, IntrospectionContext context) { TypeMapping typeMapping = context.getTypeMapping(implClass); Class<?> baseType = helper.getBaseType(type, typeMapping); ServiceContract contract = contractProcessor.introspect(baseType, implClass, context, componentType); if (contract.getOperations().isEmpty()) { String interfaceName = contract.getInterfaceName(); InvalidProducerInterface error = new InvalidProducerInterface("Producer interfaces must have at least one method: " + interfaceName, member, componentType); context.addError(error); } return new Producer<>(name, contract); }
private void addReference(InjectingComponentType componentType, TypeMapping typeMapping, String name, Type parameterType, InjectionSite site, Annotation[] annotations, IntrospectionContext context) { Class<?> type = helper.getBaseType(parameterType, typeMapping); ServiceContract contract = contractProcessor.introspect(type, context, componentType); ReferenceDefinition reference = new ReferenceDefinition(name, contract); helper.processMultiplicity(reference, false, parameterType, typeMapping); if (policyProcessor != null) { for (Annotation annotation : annotations) { policyProcessor.process(annotation, reference, context); } } componentType.add(reference, site); } }
@SuppressWarnings({"unchecked"}) private ReferenceDefinition createDefinition(String name, boolean required, Type type, Class<?> implClass, Annotation[] annotations, InjectingComponentType componentType, IntrospectionContext context) { TypeMapping typeMapping = context.getTypeMapping(implClass); Class<?> baseType = helper.getBaseType(type, typeMapping); ServiceContract contract = contractProcessor.introspect(baseType, implClass, context, componentType); ReferenceDefinition definition = new ReferenceDefinition(name, contract); helper.processMultiplicity(definition, required, type, typeMapping); if (policyProcessor != null) { for (Annotation annotation : annotations) { policyProcessor.process(annotation, definition, context); } } return definition; }
public void visitConstructorParameter(Monitor annotation, Constructor<?> constructor, int index, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { String name = helper.getSiteName(constructor, index, null); Type genericType = helper.getGenericType(constructor, index); TypeMapping typeMapping = context.getTypeMapping(implClass); Class<?> type = helper.getBaseType(genericType, typeMapping); ConstructorInjectionSite site = new ConstructorInjectionSite(constructor, index); MonitorResourceReference resource = createDefinition(name, annotation, type, componentType, context); componentType.add(resource, site); }
public void visitConstructorParameter(Monitor annotation, Constructor<?> constructor, int index, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { String name = helper.getSiteName(constructor, index, null); Type genericType = helper.getGenericType(constructor, index); TypeMapping typeMapping = context.getTypeMapping(implClass); Class<?> type = helper.getBaseType(genericType, typeMapping); ConstructorInjectionSite site = new ConstructorInjectionSite(constructor, index); MonitorResourceReference resource = createDefinition(name, annotation, type, componentType, context); componentType.add(resource, site); }
public void visitConstructorParameter(Monitor annotation, Constructor<?> constructor, int index, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { String name = helper.getSiteName(constructor, index, null); Type genericType = helper.getGenericType(constructor, index); TypeMapping typeMapping = context.getTypeMapping(implClass); Class<?> type = helper.getBaseType(genericType, typeMapping); ConstructorInjectionSite site = new ConstructorInjectionSite(constructor, index); MonitorResourceReference resource = createDefinition(name, annotation, type, componentType, context); componentType.add(resource, site); }