/** * */ private void analyzeParameters() { final AnnotatedMethod aMethod = AnnotationManager.getAnnotatedClass(method.getDeclaringClass()).getAnnotatedMethod(method); final Annotation[][] parameterAnnotations = aMethod.getParameterAnnotations(); int parameterSize = aMethod.getMethod().getParameterTypes().length; for(int i = 0; i < parameterAnnotations.length; i++) { for(final Annotation annotation : parameterAnnotations[i]) { if(Param.class.equals(annotation.annotationType())) { namedParameters = true; final Param param = (Param) annotation; final String name = param.value().trim(); if(name.length() == 0) { throw new RuntimeException("Illegal empty parameter value encounterd on parameter " + i + " of method '" + method + "' from class '" + method.getDeclaringClass().getName() +"'."); } if(parameterPositions == null) { parameterPositions = new HashMap<String, Integer>(); } parameterPositions.put(param.value(), i); break; } } } if(namedParameters && parameterPositions.size() != parameterSize) { throw new RuntimeException("Not all the parameters of the method '" + method.getDeclaringClass().getName() + "." + method + "' are annotated with the '" + Param.class.getName() + "' annotation." + " All the parameters of the method need to be have the '" + Param.class.getName() + "' annotation when using the annotation on a method."); } }
/** * */ private void analyzeParameters() { final AnnotatedMethod aMethod = AnnotationManager.getAnnotatedClass(method.getDeclaringClass()).getAnnotatedMethod(method); final Annotation[][] parameterAnnotations = aMethod.getParameterAnnotations(); int parameterSize = aMethod.getMethod().getParameterTypes().length; for(int i = 0; i < parameterAnnotations.length; i++) { for(final Annotation annotation : parameterAnnotations[i]) { if(Param.class.equals(annotation.annotationType())) { namedParameters = true; final Param param = (Param) annotation; final String name = param.value().trim(); if(name.length() == 0) { throw new RuntimeException("Illegal empty parameter value encounterd on parameter " + i + " of method '" + method + "' from class '" + method.getDeclaringClass().getName() +"'."); } if(parameterPositions == null) { parameterPositions = new HashMap<String, Integer>(); } parameterPositions.put(param.value(), i); break; } } } if(namedParameters && parameterPositions.size() != parameterSize) { throw new RuntimeException("Not all the parameters of the method '" + method.getDeclaringClass().getName() + "." + method + "' are annotated with the '" + Param.class.getName() + "' annotation." + " All the parameters of the method need to be have the '" + Param.class.getName() + "' annotation when using the annotation on a method."); } }
final Annotation[][] paramAnnotations = aMethod.getParameterAnnotations(); final Annotation[][] paramAnnotations = aMethod.getParameterAnnotations();
final Annotation[][] paramAnnotations = aMethod.getParameterAnnotations(); final Annotation[][] paramAnnotations = aMethod.getParameterAnnotations();
final Annotation[][] paramAnnotations = aMethod.getParameterAnnotations(); final Annotation[][] paramAnnotations = aMethod.getParameterAnnotations();