@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;
}