private boolean hasEncodedAnnotation(Injectee injectee) { AnnotatedElement element = injectee.getParent(); final boolean isConstructor = element instanceof Constructor; final boolean isMethod = element instanceof Method; // if injectee is method or constructor, check its parameters if (isConstructor || isMethod) { Annotation[] annotations; if (isMethod) { annotations = ((Method) element).getParameterAnnotations()[injectee.getPosition()]; } else { annotations = ((Constructor) element).getParameterAnnotations()[injectee.getPosition()]; } for (Annotation annotation : annotations) { if (annotation.annotationType().equals(Encoded.class)) { return true; } } } // check injectee itself (method, constructor or field) if (element.isAnnotationPresent(Encoded.class)) { return true; } // check class which contains injectee Class<?> clazz = injectee.getInjecteeClass(); return clazz.isAnnotationPresent(Encoded.class); }
private boolean hasEncodedAnnotation(Injectee injectee) { AnnotatedElement element = injectee.getParent(); final boolean isConstructor = element instanceof Constructor; final boolean isMethod = element instanceof Method; // if injectee is method or constructor, check its parameters if (isConstructor || isMethod) { Annotation[] annotations; if (isMethod) { annotations = ((Method) element).getParameterAnnotations()[injectee.getPosition()]; } else { annotations = ((Constructor) element).getParameterAnnotations()[injectee.getPosition()]; } for (Annotation annotation : annotations) { if (annotation.annotationType().equals(Encoded.class)) { return true; } } } // check injectee itself (method, constructor or field) if (element.isAnnotationPresent(Encoded.class)) { return true; } // check class which contains injectee Class<?> clazz = injectee.getInjecteeClass(); return clazz.isAnnotationPresent(Encoded.class); }
private DependencyDescriptor createSpringDependencyDescriptor(final Injectee injectee) { AnnotatedElement annotatedElement = injectee.getParent(); if (annotatedElement.getClass().isAssignableFrom(Field.class)) { return new DependencyDescriptor((Field) annotatedElement, !injectee.isOptional()); } else if (annotatedElement.getClass().isAssignableFrom(Method.class)) { return new DependencyDescriptor( new MethodParameter((Method) annotatedElement, injectee.getPosition()), !injectee.isOptional()); } else { return new DependencyDescriptor( new MethodParameter((Constructor) annotatedElement, injectee.getPosition()), !injectee.isOptional()); } }
Annotation[] annotations; if (annotated.getClass().equals(Constructor.class)) { annotations = ((Constructor) annotated).getParameterAnnotations()[injectee.getPosition()]; } else { annotations = annotated.getDeclaredAnnotations();
Annotation[] annotations; if (annotated.getClass().equals(Constructor.class)) { annotations = ((Constructor) annotated).getParameterAnnotations()[injectee.getPosition()]; } else { annotations = annotated.getDeclaredAnnotations();
private RequiredTypeOverridingInjectee(Injectee injectee, Type requiredType) { setFactory(injectee.isFactory()); setInjecteeClass(injectee.getInjecteeClass()); setInjecteeDescriptor(injectee.getInjecteeDescriptor()); setOptional(injectee.isOptional()); setParent(injectee.getParent()); setPosition(injectee.getPosition()); setRequiredQualifiers(injectee.getRequiredQualifiers()); setRequiredType(requiredType); } }
private boolean hasEncodedAnnotation(Injectee injectee) { AnnotatedElement element = injectee.getParent(); final boolean isConstructor = element instanceof Constructor; final boolean isMethod = element instanceof Method; // if injectee is method or constructor, check its parameters if (isConstructor || isMethod) { Annotation[] annotations; if (isMethod) { annotations = ((Method) element).getParameterAnnotations()[injectee.getPosition()]; } else { annotations = ((Constructor) element).getParameterAnnotations()[injectee.getPosition()]; } for (Annotation annotation : annotations) { if (annotation.annotationType().equals(Encoded.class)) { return true; } } } // check injectee itself (method, constructor or field) if (element.isAnnotationPresent(Encoded.class)) { return true; } // check class which contains injectee Class<?> clazz = injectee.getInjecteeClass(); return clazz.isAnnotationPresent(Encoded.class); }
Annotation[] annotations; if (annotated.getClass().equals(Constructor.class)) { annotations = ((Constructor) annotated).getParameterAnnotations()[injectee.getPosition()]; } else { annotations = annotated.getDeclaredAnnotations();
private boolean hasEncodedAnnotation(Injectee injectee) { AnnotatedElement element = injectee.getParent(); final boolean isConstructor = element instanceof Constructor; final boolean isMethod = element instanceof Method; // if injectee is method or constructor, check its parameters if (isConstructor || isMethod) { Annotation[] annotations; if (isMethod) { annotations = ((Method) element).getParameterAnnotations()[injectee.getPosition()]; } else { annotations = ((Constructor) element).getParameterAnnotations()[injectee.getPosition()]; } for (Annotation annotation : annotations) { if (annotation.annotationType().equals(Encoded.class)) { return true; } } } // check injectee itself (method, constructor or field) if (element.isAnnotationPresent(Encoded.class)) { return true; } // check class which contains injectee Class<?> clazz = injectee.getInjecteeClass(); return clazz.isAnnotationPresent(Encoded.class); }
private DependencyDescriptor createSpringDependencyDescriptor(final Injectee injectee) { AnnotatedElement annotatedElement = injectee.getParent(); if (annotatedElement.getClass().isAssignableFrom(Field.class)) { return new DependencyDescriptor((Field) annotatedElement, !injectee.isOptional()); } else if (annotatedElement.getClass().isAssignableFrom(Method.class)) { return new DependencyDescriptor( new MethodParameter((Method) annotatedElement, injectee.getPosition()), !injectee.isOptional()); } else { return new DependencyDescriptor( new MethodParameter((Constructor) annotatedElement, injectee.getPosition()), !injectee.isOptional()); } }
Annotation[] annotations; if (annotated.getClass().equals(Constructor.class)) { annotations = ((Constructor) annotated).getParameterAnnotations()[injectee.getPosition()]; } else { annotations = annotated.getDeclaredAnnotations();