@Override
 public <T> void hear(TypeLiteral<T> typeLiteral, TypeEncounter<T> typeEncounter) {
   for (Field field : typeLiteral.getRawType().getDeclaredFields()) {
     if (field.isAnnotationPresent(Redis.class)) {
       typeEncounter.register(new RedisMembersInjector<T>(this.cache, field));
     }
   }
 }
  public <I> void hear(TypeLiteral<I> injectableType, TypeEncounter<I> encounter) {

    Class<? super I> type = injectableType.getRawType();
    Set<Field> loggerFields = getLoggerFieldsAnnotatedWithResource(type);
    if (loggerFields.size() == 0) return;

    Logger logger = loggerFactory.getLogger(type.getName());

    for (Field field : loggerFields) {
      if (field.isAnnotationPresent(Named.class)) {
        Named name = field.getAnnotation(Named.class);
        encounter.register(
            new AssignLoggerToField<I>(loggerFactory.getLogger(name.value()), field));
      } else {
        encounter.register(new AssignLoggerToField<I>(logger, field));
      }
    }
  }
 public <T> void hear(TypeLiteral<T> typeLiteral, TypeEncounter<T> typeEncounter) {
   Class<?> clazz = typeLiteral.getRawType();
   while (clazz != null) {
     for (Field field : clazz.getDeclaredFields()) {
       if (field.isAnnotationPresent(UserComment.class)) {
         typeEncounter.register(new UserCommentInjector<T>(field));
       }
     }
     clazz = clazz.getSuperclass();
   }
 }
  @Override
  public <T> void hear(TypeLiteral<T> literal, TypeEncounter<T> encounter) {
    Class<? super T> klass = literal.getRawType();

    do {
      for (Method method : klass.getDeclaredMethods()) {
        final MethodInterceptor interceptor =
            TimedInterceptor.forMethod(metricRegistry, klass, method);
        if (interceptor != null) {
          encounter.bindInterceptor(Matchers.only(method), interceptor);
        }
      }
    } while ((klass = klass.getSuperclass()) != null);
  }
  @Override
  public <I> void hear(final TypeLiteral<I> type, TypeEncounter<I> encounter) {
    final Field field = getLoggerField(type.getRawType());

    if (field != null) {
      encounter.register(
          new InjectionListener<I>() {
            @Override
            public void afterInjection(I injectee) {
              try {
                boolean b = field.isAccessible();
                if (!b) field.setAccessible(true);
                field.set(injectee, LoggerFactory.getLogger(type.getRawType()));
                if (!b) field.setAccessible(false);
              } catch (IllegalAccessException e) {
                throw new ProvisionException("Unable to inject SLF4J logger", e);
              }
            }
          });
    }
  }
  @Override
  public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) {
    LOG.trace("Found new injectable type %s", type);

    Class<? super I> klass = type.getRawType();
    // Loop over the class and superclasses
    do {
      for (final Method m : klass.getDeclaredMethods()) {

        // Inspect declared methods for @OnStage

        final OnStage onStage = m.getAnnotation(OnStage.class);
        if (onStage == null) {
          continue;
        }

        LOG.trace("Will invoke %s on %s", m, onStage.value());

        encounter.register(
            new InjectionListener<I>() {
              @Override
              public void afterInjection(I injectee) {
                LifecycleInvocation invocation =
                    new LifecycleInvocation(new LifecycleStage(onStage.value()), injectee, m);

                if (lifecycle != null) { // If the lifecycle is available, register now
                  addListener(invocation);
                } else { // Otherwise, do it later, when the lifecycle is injected
                  Preconditions.checkState(
                      foundInvocations != null, "Injection after lifecycle start!");
                  foundInvocations.add(invocation);
                }
              }
            });
      }
      klass = klass.getSuperclass();
    } while (klass != null);
  }