private static void ensureIsBindingAnnotation(Class<? extends Annotation> annotationType) { checkArgument( Annotations.isBindingAnnotation(annotationType), "%s is not a binding annotation. Please annotate it with @BindingAnnotation.", annotationType.getName()); }
/** Returns the binding annotation on {@code member}, or null if there isn't one. */ public static Annotation findBindingAnnotation( Errors errors, Member member, Annotation[] annotations) { Annotation found = null; for (Annotation annotation : annotations) { Class<? extends Annotation> annotationType = annotation.annotationType(); if (isBindingAnnotation(annotationType)) { if (found != null) { errors.duplicateBindingAnnotations(member, found.annotationType(), annotationType); } else { found = annotation; } } } return found; }
private static void ensureIsBindingAnnotation(Class<? extends Annotation> annotationType) { checkArgument( Annotations.isBindingAnnotation(annotationType), "%s is not a binding annotation. Please annotate it with @BindingAnnotation.", annotationType.getName()); }
private static void ensureIsBindingAnnotation(Class<? extends Annotation> annotationType) { checkArgument( Annotations.isBindingAnnotation(annotationType), "%s is not a binding annotation. Please annotate it with @BindingAnnotation.", annotationType.getName()); }
private static void ensureIsBindingAnnotation(Class<? extends Annotation> annotationType) { checkArgument(Annotations.isBindingAnnotation(annotationType), "%s is not a binding annotation. Please annotate it with @BindingAnnotation.", annotationType.getName()); }
private static Key<?> buildKey(TypeLiteral<?> type, Annotation[] annotations) { for (Annotation annotation : annotations) if (Annotations.isBindingAnnotation(annotation.annotationType())) return Key.get(type, annotation); return Key.get(type); }
private static Key<?> buildKey(TypeLiteral<?> type, Annotation[] annotations) { for (Annotation annotation : annotations) if (Annotations.isBindingAnnotation(annotation.annotationType())) return Key.get(type, annotation); return Key.get(type); }
private static Key<?> buildKey(TypeLiteral<?> type, Annotation[] annotations) { for (Annotation annotation : annotations) if (Annotations.isBindingAnnotation(annotation.annotationType())) return Key.get(type, annotation); return Key.get(type); }
/** * Returns the unique binding annotation from the specified list, or * {@code null} if there are none. * * @throws IllegalStateException if multiple binding annotations exist. */ private Annotation getBindingAnnotation(Annotation[] annotations) { Annotation bindingAnnotation = null; for (Annotation annotation : annotations) { if (Annotations.isBindingAnnotation(annotation.annotationType())) { checkArgument(bindingAnnotation == null, "Parameter has multiple binding annotations: %s and %s", bindingAnnotation, annotation); bindingAnnotation = annotation; } } return bindingAnnotation; } }
private static void ensureIsBindingAnnotation(Class<? extends Annotation> annotationType) { checkArgument(Annotations.isBindingAnnotation(annotationType), "%s is not a binding annotation. Please annotate it with @BindingAnnotation.", annotationType.getName()); }
private static void ensureIsBindingAnnotation(Class<? extends Annotation> annotationType) { checkArgument(Annotations.isBindingAnnotation(annotationType), "%s is not a binding annotation. Please annotate it with @BindingAnnotation.", annotationType.getName()); }
private static void ensureIsBindingAnnotation(Class<? extends Annotation> annotationType) { checkArgument(Annotations.isBindingAnnotation(annotationType), "%s is not a binding annotation. Please annotate it with @BindingAnnotation.", annotationType.getName()); }
/** Returns the binding annotation on {@code member}, or null if there isn't one. */ public static Annotation findBindingAnnotation( Errors errors, Member member, Annotation[] annotations) { Annotation found = null; for (Annotation annotation : annotations) { Class<? extends Annotation> annotationType = annotation.annotationType(); if (isBindingAnnotation(annotationType)) { if (found != null) { errors.duplicateBindingAnnotations(member, found.annotationType(), annotationType); } else { found = annotation; } } } return found; }
/** Returns the binding annotation on {@code member}, or null if there isn't one. */ public static Annotation findBindingAnnotation( Errors errors, Member member, Annotation[] annotations) { Annotation found = null; for (Annotation annotation : annotations) { Class<? extends Annotation> annotationType = annotation.annotationType(); if (isBindingAnnotation(annotationType)) { if (found != null) { errors.duplicateBindingAnnotations(member, found.annotationType(), annotationType); } else { found = annotation; } } } return found; }
@Override public Key<?> getKey(TypeLiteral<?> injectedType, Field injectedMember, A resourceAnnotation) { for (Annotation annotation : injectedMember.getAnnotations()) if (Annotations.isBindingAnnotation(annotation.annotationType())) return Key.get(injectedType.getFieldType(injectedMember), annotation); return Key.get(injectedType.getFieldType(injectedMember)); }
@Override public Key<?> getKey(TypeLiteral<?> injectedType, Field injectedMember, A resourceAnnotation) { for (Annotation annotation : injectedMember.getAnnotations()) if (Annotations.isBindingAnnotation(annotation.annotationType())) return Key.get(injectedType.getFieldType(injectedMember), annotation); return Key.get(injectedType.getFieldType(injectedMember)); }
@Override public Key<?> getKey(TypeLiteral<?> injectedType, Field injectedMember, A resourceAnnotation) { for (Annotation annotation : injectedMember.getAnnotations()) if (Annotations.isBindingAnnotation(annotation.annotationType())) return Key.get(injectedType.getFieldType(injectedMember), annotation); return Key.get(injectedType.getFieldType(injectedMember)); }
/** * Returns the binding annotation on {@code member}, or null if there isn't one. */ public static Annotation findBindingAnnotation( Errors errors, Member member, Annotation[] annotations) { Annotation found = null; for (Annotation annotation : annotations) { Class<? extends Annotation> annotationType = annotation.annotationType(); if (isBindingAnnotation(annotationType)) { if (found != null) { errors.duplicateBindingAnnotations(member, found.annotationType(), annotationType); } else { found = annotation; } } } return found; }
/** * Returns the binding annotation on {@code member}, or null if there isn't one. */ public static Annotation findBindingAnnotation( Errors errors, Member member, Annotation[] annotations) { Annotation found = null; for (Annotation annotation : annotations) { Class<? extends Annotation> annotationType = annotation.annotationType(); if (isBindingAnnotation(annotationType)) { if (found != null) { errors.duplicateBindingAnnotations(member, found.annotationType(), annotationType); } else { found = annotation; } } } return found; }
private static Optional<Annotation> getAnnotationForBeanDefinition(BeanDefinition definition, ConfigurableListableBeanFactory beanFactory) { if (definition instanceof AnnotatedBeanDefinition && ((AnnotatedBeanDefinition) definition).getFactoryMethodMetadata() != null) { try { Method factoryMethod = getFactoryMethod(beanFactory, definition); return Arrays.stream(AnnotationUtils.getAnnotations(factoryMethod)) .filter(a -> Annotations.isBindingAnnotation(a.annotationType())).findFirst(); } catch (Exception e) { return Optional.empty(); } } else { return Optional.empty(); } }