Matcher m = BINDNAME.matcher(method.getName());
if (m.matches())
def.name = m.group(2);
else
analyzer.error("Invalid name for bind method %s", method.getName()).details(
new DeclarativeServicesAnnotationError(className.getFQN(), method.getName(), method.getDescriptor().toString(),
ErrorType.INVALID_REFERENCE_BIND_METHOD_NAME));
}
def.unbind = reference.unbind();
def.updated = reference.updated();
def.bind = method.getName();
def.bindDescriptor = method.getDescriptor().toString();
String annoService = raw.get("service");
if (annoService != null)
annoService = Clazz.objectDescriptorToFQN(annoService);
ReferenceScope scope = reference.scope();
String service = determineReferenceType(method.getDescriptor().toString(), def, annoService, scope);
def.service = service;
if (service == null)
analyzer.error(
"In component %s, method %s, cannot recognize the signature of the descriptor: %s",
component.name, def.name, method.getDescriptor());
// Check if we have a target, this must be a filter
def.target = reference.target();
if (def.target != null) {
String error = Verifier.validateFilter(def.target);
if (error != null)
analyzer.error("Invalid target filter %s for %s: %s", def.target, def.name, error)
.details(new DeclarativeServicesAnnotationError(className.getFQN(), def.bind, def.bindDescriptor,
ErrorType.INVALID_TARGET_FILTER));
}
if (component.references.containsKey(def.name))
analyzer.error(
"In component %s, multiple references with the same name: %s. Previous def: %s, this def: %s",
component.implementation, component.references.get(def.name), def.service, "")
.details(new DeclarativeServicesAnnotationError(className.getFQN(), null, null,
ErrorType.MULTIPLE_REFERENCES_SAME_NAME));
else
component.references.put(def.name, def);
def.cardinality = reference.cardinality();