@Test public void testAnnotationTypeKeyFactory() { Bindings.KeyFactory factory = Bindings.annotatedKeyFactory(QualifierKey.class); assertEquals(Key.get(String.class, QualifierKey.class), factory.create(String.class)); assertEquals(Key.get(STRING_LIST, QualifierKey.class), factory.create(STRING_LIST)); }
public static KeyFactory annotatedKeyFactory(final Class<? extends Annotation> annotationType) { checkBindingAnnotation(annotationType); return new KeyFactory() { @Override public <T> Key<T> create(Class<T> type) { return Key.get(type, annotationType); } @Override public <T> Key<T> create(TypeLiteral<T> type) { return Key.get(type, annotationType); } }; }
Bindings { public static KeyFactory annotatedKeyFactory(final Class<? extends Annotation> annotationType) { checkBindingAnnotation(annotationType); return new KeyFactory() { @Override public <T> Key<T> create(Class<T> type) { return Key.get(type, annotationType); } @Override public <T> Key<T> create(TypeLiteral<T> type) { return Key.get(type, annotationType); } }; } }
Bindings { public static KeyFactory annotatedKeyFactory(final Class<? extends Annotation> annotationType) { checkBindingAnnotation(annotationType); return new KeyFactory() { @Override public <T> Key<T> create(Class<T> type) { return Key.get(type, annotationType); } @Override public <T> Key<T> create(TypeLiteral<T> type) { return Key.get(type, annotationType); } }; } private  Bindings(); }
Bindings { public static KeyFactory annotatedKeyFactory(final Class<? extends Annotation> annotationType) { checkBindingAnnotation(annotationType); return new KeyFactory() { @Override public <T> Key<T> create(Class<T> type) { return Key.get(type, annotationType); } @Override public <T> Key<T> create(TypeLiteral<T> type) { return Key.get(type, 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 KeyFactory annotatedKeyFactory(final Class<? extends Annotation> annotationType) { checkBindingAnnotation(annotationType); return new KeyFactory() { @Override public <T> Key<T> create(Class<T> type) { return Key.get(type, annotationType); } @Override public <T> Key<T> create(TypeLiteral<T> type) { return Key.get(type, 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);  }