/** * @param result map of classes to annotations * @param baseClass is the superclass or one of the superinterfaces. */ private void fillAnnotationsForOneClass(final HashMap<Class<?>, Annotation> result, final Class<?> baseClass) { addAnnotations(result, AnnotationManager.getAnnotatedClass(baseClass).getAllAnnotations()); }
/** * @param result map of classes to annotations * @param baseClass is the superclass or one of the superinterfaces. */ private void fillAnnotationsForOneClass(final HashMap<Class<?>, Annotation> result, final Class<?> baseClass) { addAnnotations(result, AnnotationManager.getAnnotatedClass(baseClass).getAllAnnotations()); }
/** * @param result map of classes to annotations * @param baseClass is the superclass or one of the superinterfaces. */ private void fillAnnotationsForOneClass(final HashMap<Class<?>, Annotation> result, final Class<?> baseClass) { addAnnotations(result, AnnotationManager.getAnnotatedClass(baseClass).getAllAnnotations()); }
/** * */ 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."); } }
private Map<Class<?>, Annotation> getAllAnnotationMapCalculated(){ final HashMap<Class<?>, Annotation> result = new HashMap<Class<?>, Annotation>(); final Class<?> superClass = getAnnotatedClass().getTheClass().getSuperclass(); // Get the superclass's overriden method annotations if (superClass != null) { fillAnnotationsForOneMethod(result, AnnotationManager.getAnnotatedClass( superClass) .getAnnotatedMethod(getMethod().getName(), getMethod().getParameterTypes())); } // Get the superinterfaces' overriden method annotations for (final Class<?> c : getAnnotatedClass().getTheClass().getInterfaces()){ fillAnnotationsForOneMethod(result, AnnotationManager.getAnnotatedClass(c) .getAnnotatedMethod(getMethod().getName(), getMethod().getParameterTypes())); } // Get its own annotations. They have preference to inherited annotations. for (final Annotation annotation : getMethod().getDeclaredAnnotations()) { result.put(annotation.getClass().getInterfaces()[0], annotation); } return result; }
private Map<Class<?>, Annotation> getAllAnnotationMapCalculated(){ final HashMap<Class<?>, Annotation> result = new HashMap<Class<?>, Annotation>(); final Class<?> superClass = getAnnotatedClass().getTheClass().getSuperclass(); // Get the superclass's overriden method annotations if (superClass != null) { fillAnnotationsForOneMethod(result, AnnotationManager.getAnnotatedClass( superClass) .getAnnotatedMethod(getMethod().getName(), getMethod().getParameterTypes())); } // Get the superinterfaces' overriden method annotations for (final Class<?> c : getAnnotatedClass().getTheClass().getInterfaces()){ fillAnnotationsForOneMethod(result, AnnotationManager.getAnnotatedClass(c) .getAnnotatedMethod(getMethod().getName(), getMethod().getParameterTypes())); } // Get its own annotations. They have preference to inherited annotations. for (final Annotation annotation : getMethod().getDeclaredAnnotations()) { result.put(annotation.getClass().getInterfaces()[0], annotation); } return result; }
private Map<Class<?>, Annotation> getAllAnnotationMapCalculated(){ final HashMap<Class<?>, Annotation> result = new HashMap<Class<?>, Annotation>(); final Class<?> superClass = getAnnotatedClass().getTheClass().getSuperclass(); // Get the superclass's overriden method annotations if (superClass != null) { fillAnnotationsForOneMethod(result, AnnotationManager.getAnnotatedClass( superClass) .getAnnotatedMethod(getMethod().getName(), getMethod().getParameterTypes())); } // Get the superinterfaces' overriden method annotations for (final Class<?> c : getAnnotatedClass().getTheClass().getInterfaces()){ fillAnnotationsForOneMethod(result, AnnotationManager.getAnnotatedClass(c) .getAnnotatedMethod(getMethod().getName(), getMethod().getParameterTypes())); } // Get its own annotations. They have preference to inherited annotations. for (final Annotation annotation : getMethod().getDeclaredAnnotations()) { result.put(annotation.getClass().getInterfaces()[0], annotation); } return result; }
if (superClass != null) { final AnnotatedClass aClass = AnnotationManager.getAnnotatedClass(superClass); final AnnotatedMethod aMethod = aClass.getAnnotatedMethod(getMethod().getName(), getMethod().getParameterTypes()); final AnnotatedClass aClass = AnnotationManager.getAnnotatedClass(c); final AnnotatedMethod aMethod = aClass.getAnnotatedMethod(getMethod().getName(), getMethod().getParameterTypes());
final AnnotatedClass annotatedClass = AnnotationManager.getAnnotatedClass(dao.getClass());
AnnotatedClass annotatedClass = AnnotationManager.getAnnotatedClass(daoClass);
final AnnotatedClass annotatedClass = AnnotationManager.getAnnotatedClass(dao.getClass());
if (superClass != null) { final AnnotatedClass aClass = AnnotationManager.getAnnotatedClass(superClass); final AnnotatedMethod aMethod = aClass.getAnnotatedMethod(getMethod().getName(), getMethod().getParameterTypes()); final AnnotatedClass aClass = AnnotationManager.getAnnotatedClass(c); final AnnotatedMethod aMethod = aClass.getAnnotatedMethod(getMethod().getName(), getMethod().getParameterTypes());
AnnotatedClass annotatedClass = AnnotationManager.getAnnotatedClass(daoClass);
if (superClass != null) { final AnnotatedClass aClass = AnnotationManager.getAnnotatedClass(superClass); final AnnotatedMethod aMethod = aClass.getAnnotatedMethod(getMethod().getName(), getMethod().getParameterTypes()); final AnnotatedClass aClass = AnnotationManager.getAnnotatedClass(c); final AnnotatedMethod aMethod = aClass.getAnnotatedMethod(getMethod().getName(), getMethod().getParameterTypes());