*/
PojoMetadata manipulation = getFactory().getPojoMetadata();
AtomicImplementationDeclaration primitive = (AtomicImplementationDeclaration) declaration;
for (ProviderInstrumentation providerInstrumentation : primitive.getProviderInstrumentation()) {
MessageReference messageReference = providerInstrumentation.getProvidedResource().as(MessageReference.class);
if (messageReference == null)
continue;
if (! (providerInstrumentation instanceof ProviderInstrumentation.MessageProviderMethodInterception))
continue;
ProviderInstrumentation.MessageProviderMethodInterception interception =
(ProviderInstrumentation.MessageProviderMethodInterception) providerInstrumentation;
/*
* Search for the specified method to intercept, we always look for a perfect match of the
* specified signature, and do not allow ambiguous method names
*/
MethodMetadata candidate = null;
for (MethodMetadata method : manipulation.getMethods(interception.getMethodName())) {
if (interception.getMethodSignature() == null) {
candidate = method;
break;
}
String signature[] = Util.split(interception.getMethodSignature());
String arguments[] = method.getMethodArguments();
boolean match = (signature.length == arguments.length);
for (int i = 0; match && i < signature.length; i++) {
if (!signature[i].equals(arguments[i]))
match = false;
}
match = match && method.getMethodReturn().equals(messageReference.getJavaType());
if (match) {
candidate = method;
break;
}
}