in modules/aop-ext/src/main/java/org/apache/ignite/compute/gridify/aop/GridifySetToSetAbstractAspect.java [48:99]
protected void checkMethodSignature(Method mtd) throws IgniteCheckedException {
Class<?>[] paramTypes = mtd.getParameterTypes();
Collection<Integer> allowedParamIdxs = new LinkedList<>();
for (int i = 0; i < paramTypes.length; i++) {
Class<?> paramType = paramTypes[i];
if (GridifyUtils.isMethodParameterTypeAllowed(paramType))
allowedParamIdxs.add(i);
}
if (allowedParamIdxs.isEmpty()) {
throw new IgniteCheckedException("Invalid method signature. Failed to get valid method parameter types " +
"[mtdName=" + mtd.getName() + ", allowedTypes=" + GridifyUtils.getAllowedMethodParameterTypes() + ']');
}
List<Integer> annParamIdxs = new LinkedList<>();
for (int i = 0; i < paramTypes.length; i++) {
Class<?> paramType = paramTypes[i];
if (GridifyUtils.isMethodParameterTypeAnnotated(paramType.getDeclaredAnnotations()))
annParamIdxs.add(i);
}
if (annParamIdxs.size() > 1) {
throw new IgniteCheckedException("Invalid method signature. Only one method parameter can may annotated with @" +
GridifyInput.class.getSimpleName() +
"[mtdName=" + mtd.getName() + ", allowedTypes=" + GridifyUtils.getAllowedMethodParameterTypes() +
", annParamIdxs=" + annParamIdxs + ']');
}
if (allowedParamIdxs.size() > 1 && annParamIdxs.isEmpty()) {
throw new IgniteCheckedException("Invalid method signature. Method parameter must be annotated with @" +
GridifyInput.class.getSimpleName() +
"[mtdName=" + mtd.getName() + ", allowedTypes=" + GridifyUtils.getAllowedMethodParameterTypes() +
", allowedParamIdxs=" + allowedParamIdxs + ']');
}
if (!annParamIdxs.isEmpty() && !allowedParamIdxs.contains(annParamIdxs.get(0))) {
throw new IgniteCheckedException("Invalid method signature. Invalid annotated parameter " +
"[mtdName=" + mtd.getName() + ", allowedTypes=" + GridifyUtils.getAllowedMethodParameterTypes() +
", allowedParamIdxs=" + allowedParamIdxs + ", annParamIdxs=" + annParamIdxs + ']');
}
if (!GridifyUtils.isMethodReturnTypeValid(mtd.getReturnType())) {
throw new IgniteCheckedException("Invalid method signature. Invalid method return type " +
"[mtdName=" + mtd.getName() + ", allowedTypes=" + GridifyUtils.getAllowedMethodReturnTypes() +
", mtdReturnType=" + mtd.getReturnType() + ']');
}
}