Package com.google.inject.spi

Examples of com.google.inject.spi.TypeListener


            for (Class c=step.getClass(); c!=Step.class; c=c.getSuperclass()) {
                bind(c).toInstance(step);
            }
        }

        bindListener(Matchers.any(), new TypeListener() {
            @Override
            public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) {
                for (Field f : type.getRawType().getDeclaredFields()) {
                    if (f.isAnnotationPresent(StepContextParameter.class)) {
                        encounter.register(new FieldInjector<I>(f));
View Full Code Here


    @Override
    public void configure(Binder binder)
    {
        binder.disableCircularProxies();

        binder.bindListener(any(), new TypeListener()
        {
            @Override
            public <T> void hear(TypeLiteral<T> type, TypeEncounter<T> encounter)
            {
                encounter.register(new InjectionListener<T>()
View Full Code Here

         return in.isAnnotationPresent(PostConstruct.class);
      }
   };

   protected void bindPostInjectionInvoke(final Closer closer, final ExecutionList list) {
      bindListener(any(), new TypeListener() {
         public <I> void hear(TypeLiteral<I> injectableType, TypeEncounter<I> encounter) {
            Collection<? extends Invokable<? super I, Object>> methods = methods(injectableType.getRawType());
            for (final Invokable<? super I, Object> method : filter(methods, isPostConstruct)) {
               encounter.register(new InjectionListener<I>() {
                  public void afterInjection(final I injectee) {
View Full Code Here

      binder.bind(target).toProvider((TypeLiteral) TypeLiteral.get(adapterType));
    }
  }
  private <T> void registerListType(Class<T> type, Binder binder) {
    final AllImplementationsProvider<T> provider = new AllImplementationsProvider<T>();
    binder.bindListener(VRaptorAbstractModule.type(Matchers.subclassesOf(type)), new TypeListener() {
      public void hear(TypeLiteral literal, TypeEncounter encounter) {
        provider.addType(literal.getRawType());
      }
    });
    binder.bind(TypeLiteral.get(Types.listOf(type))).toProvider((Provider)provider);
View Full Code Here

    AbstractModule module = new AbstractModule() {
      @Override
      protected void configure() {
        //
        bindListener(Matchers.any(), new TypeListener() {
          public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) {
            encounter.register(new PostConstructInjectionListener());
          }
        });
View Full Code Here

    private final Logger logger = LoggerFactory.getLogger(AppModule.class);

    @Override
    public void configure(Binder binder) {
        binder.bindListener(Matchers.any(), new TypeListener() {
            @Override
            public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) {
                logger.debug("{} is created", type.getRawType().getName());
            }
        });
View Full Code Here

      public boolean matches(TypeLiteral<?> t) {
        return annotationCache.annotationPresent(t.getRawType());
      }
    };
    // register SliceResourceTypeListener for classes matched with matcher
    TypeListener listener = new TypeListener() {
      @Override
      public <I> void hear(final TypeLiteral<I> type, final TypeEncounter<I> encounter) {
        encounter.register(new SliceResourceTypeListener(currentResourceProvider, mapperProvider));
      }
    };
View Full Code Here

         return in.isAnnotationPresent(PostConstruct.class);
      }
   };

   protected void bindPostInjectionInvoke(final Closer closer, final ExecutionList list) {
      bindListener(any(), new TypeListener() {
         public <I> void hear(TypeLiteral<I> injectableType, TypeEncounter<I> encounter) {
            Collection<? extends Invokable<? super I, Object>> methods = methods(injectableType.getRawType());
            for (final Invokable<? super I, Object> method : filter(methods, isPostConstruct)) {
               encounter.register(new InjectionListener<I>() {
                  public void afterInjection(final I injectee) {
View Full Code Here

TOP

Related Classes of com.google.inject.spi.TypeListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.