@Test public void testCheckBindingAnnotation() { Bindings.checkBindingAnnotation(BindKey.class); try { Bindings.checkBindingAnnotation((Class<? extends Annotation>) null); fail(); } catch (NullPointerException e) { } try { Bindings.checkBindingAnnotation(BindingAnnotation.class); fail(); } catch (IllegalArgumentException e) { } }
public static <T extends Annotation> Class<T> checkBindingAnnotation(Class<T> annotationType) { Preconditions.checkNotNull(annotationType); boolean bindingAnnotation = annotationType.isAnnotationPresent(BindingAnnotation.class); boolean qualifier = annotationType.isAnnotationPresent(Qualifier.class); Preconditions.checkArgument(bindingAnnotation || qualifier, "%s is not a @BindingAnnotation or @Qualifier", annotationType); return annotationType; }
Bindings { public static <T extends Annotation> Class<T> checkBindingAnnotation(Class<T> annotationType) { Preconditions.checkNotNull(annotationType); boolean bindingAnnotation = annotationType.isAnnotationPresent(BindingAnnotation.class); boolean qualifier = annotationType.isAnnotationPresent(Qualifier.class); Preconditions.checkArgument(bindingAnnotation || qualifier, "%s is not a @BindingAnnotation or @Qualifier", annotationType); return annotationType; } }
Bindings { public static <T extends Annotation> Class<T> checkBindingAnnotation(Class<T> annotationType) { Preconditions.checkNotNull(annotationType); boolean bindingAnnotation = annotationType.isAnnotationPresent(BindingAnnotation.class); boolean qualifier = annotationType.isAnnotationPresent(Qualifier.class); Preconditions.checkArgument(bindingAnnotation || qualifier, "%s is not a @BindingAnnotation or @Qualifier", annotationType); return annotationType; } private  Bindings(); }
Bindings { public static <T extends Annotation> Class<T> checkBindingAnnotation(Class<T> annotationType) { Preconditions.checkNotNull(annotationType); boolean bindingAnnotation = annotationType.isAnnotationPresent(BindingAnnotation.class); boolean qualifier = annotationType.isAnnotationPresent(Qualifier.class); Preconditions.checkArgument(bindingAnnotation || qualifier, "%s is not a @BindingAnnotation or @Qualifier", annotationType); return annotationType; } private  Bindings(); static void requireBinding(Binder binder, Class<?> required); static void requireBinding(Binder binder, final Key<?> required); static Module exposing(Key<?> key, Module module); static Module exposing(final Iterable<? extends Key<?>> keys, final Module module); static Class<T> checkBindingAnnotation(Class<T> annotationType); static KeyFactory annotatedKeyFactory(final Class<? extends Annotation> annotationType); }
Bindings { public static <T extends Annotation> Class<T> checkBindingAnnotation(Class<T> annotationType) { Preconditions.checkNotNull(annotationType); boolean bindingAnnotation = annotationType.isAnnotationPresent(BindingAnnotation.class); boolean qualifier = annotationType.isAnnotationPresent(Qualifier.class); Preconditions.checkArgument(bindingAnnotation || qualifier, "%s is not a @BindingAnnotation or @Qualifier", annotationType); return annotationType; } private  Bindings(); static void requireBinding(Binder binder, Class<?> required); static void requireBinding(Binder binder, final Key<?> required); static Module exposing(Key<?> key, Module module); static Module exposing(final Iterable<? extends Key<?>> keys, final Module module); static Class<T> checkBindingAnnotation(Class<T> annotationType); static KeyFactory annotatedKeyFactory(final Class<? extends Annotation> annotationType);  }