Java 类com.google.inject.spi.ProvisionListener 实例源码

项目:ProjectAres    文件:ContextualProviderModule.java   
@Override
protected void configure() {
    bindListener(Matchers.any(), new ProvisionListener() {
        @Override
        public <T> void onProvision(ProvisionInvocation<T> provision) {
            final ProvisionListener.ProvisionInvocation<?> prior = ContextualProvider.provisionInvocation.get();
            ContextualProvider.provisionInvocation.set(provision);
            try {
                provision.provision();
            } finally {
                if(prior != null) {
                    ContextualProvider.provisionInvocation.set(prior);
                } else {
                    ContextualProvider.provisionInvocation.remove();
                }
            }
        }
    });
}
项目:salta    文件:ProvisionListenerTest.java   
public void testProvisionIsNotifiedAfterContextsClear() {
    Injector injector = Guice.createInjector(new AbstractModule() {
        @Override
        protected void configure() {
            bindListener(Matchers.any(), new ProvisionListener() {
                @Override
                public <T> void onProvision(
                        ProvisionInvocation<T> provision) {
                    Object provisioned = provision.provision();
                    if (provisioned instanceof X) {
                        ((X) provisioned).init();
                    } else if (provisioned instanceof Y) {
                        X.createY = false;
                        ((Y) provisioned).init();
                    }
                }
            });
        }
    });

    X.createY = true;
    X x = injector.getInstance(X.class);
    assertNotSame(x, x.y.x);
    assertFalse("x.ID: " + x.ID + ", x.y.x.iD: " + x.y.x.ID,
            x.ID == x.y.x.ID);
}
项目:r01fb    文件:R01FBootstrapGuiceModule.java   
@Override
public void configure(Binder binder) {
    // Some debugging
    if (log.isTraceEnabled()) {
        binder.bindListener(Matchers.any(),
                            new ProvisionListener() {
                @Override @SuppressWarnings("rawtypes") 
                public void onProvision(final ProvisionInvocation provision) {
                    log.trace(">> Guice provisioning: {}",provision.getBinding());
                }
        });
    }
       log.warn("[START] R01F Bootstraping ________________________________");

    //binder.requireExplicitBindings(); // All the injected members MUST be defined at the guice modules

    binder.install(new XMLPropertiesGuiceModule());     // XMLProperties
    binder.install(new ConfigPropertiesGuiceModule());  // Configs
    binder.install(new I18NGuiceModule());              // I18N
       binder.install(new GUIDDispenserGuiceModule());      // GUIDDispenser
       binder.install(new MarsallerGuiceModule());          // Marshaller
       binder.install(new JSonMarshallerGuiceModule()); // Marshalling de JSON
       log.warn("  [END] R01F Bootstraping ________________________________");
}
项目:guice    文件:ProvisionListenerCallbackStore.java   
/**
 * Creates a new {@link ProvisionListenerStackCallback} with the correct listeners for the key.
 */
private <T> ProvisionListenerStackCallback<T> create(Binding<T> binding) {
  List<ProvisionListener> listeners = null;
  for (ProvisionListenerBinding provisionBinding : listenerBindings) {
    if (provisionBinding.getBindingMatcher().matches(binding)) {
      if (listeners == null) {
        listeners = Lists.newArrayList();
      }
      listeners.addAll(provisionBinding.getListeners());
    }
  }
  if (listeners == null || listeners.isEmpty()) {
    // Optimization: don't bother constructing the callback if there are
    // no listeners.
    return ProvisionListenerStackCallback.emptyListener();
  }
  return new ProvisionListenerStackCallback<T>(binding, listeners);
}
项目:guice-old    文件:ProvisionListenerCallbackStore.java   
/**
 * Creates a new {@link ProvisionListenerStackCallback} with the correct listeners
 * for the key.
 */
private <T> ProvisionListenerStackCallback<T> create(Binding<T> binding) {
  List<ProvisionListener> listeners = null;
  for (ProvisionListenerBinding provisionBinding : listenerBindings) {
    if (provisionBinding.getBindingMatcher().matches(binding)) {
      if (listeners == null) {
        listeners = Lists.newArrayList();
      }
      listeners.addAll(provisionBinding.getListeners());
    }
  }
  if (listeners == null || listeners.isEmpty()) {
    // Optimization: don't bother constructing the callback if there are
    // no listeners.
    return ProvisionListenerStackCallback.emptyListener();
  }
  return new ProvisionListenerStackCallback<T>(binding, listeners);
}
项目:guice-old    文件:ProvisionListenerTest.java   
public void testProvisionIsNotifiedAfterContextsClear() {
  Injector injector = Guice.createInjector(new AbstractModule() {
    @Override
    protected void configure() {
      bindListener(Matchers.any(), new ProvisionListener() {
        @Override
        public <T> void onProvision(ProvisionInvocation<T> provision) {
          Object provisioned = provision.provision();
          if (provisioned instanceof X) {
            ((X)provisioned).init();
          } else if (provisioned instanceof Y) {
            X.createY = false;
            ((Y)provisioned).init();
          }
        }
      });
    }
  });

  X.createY = true;
  X x = injector.getInstance(X.class);
  assertNotSame(x, x.y.x);
  assertFalse("x.ID: " + x.ID + ", x.y.x.iD: " + x.y.x.ID, x.ID == x.y.x.ID);
}
项目:google-guice    文件:ProvisionListenerCallbackStore.java   
/**
 * Creates a new {@link ProvisionListenerStackCallback} with the correct listeners
 * for the key.
 */
private <T> ProvisionListenerStackCallback<T> create(Binding<T> binding) {
  List<ProvisionListener> listeners = null;
  for (ProvisionListenerBinding provisionBinding : listenerBindings) {
    if (provisionBinding.getBindingMatcher().matches(binding)) {
      if (listeners == null) {
        listeners = Lists.newArrayList();
      }
      listeners.addAll(provisionBinding.getListeners());
    }
  }
  if (listeners == null || listeners.isEmpty()) {
    // Optimization: don't bother constructing the callback if there are
    // no listeners.
    return ProvisionListenerStackCallback.emptyListener();
  }
  return new ProvisionListenerStackCallback<T>(binding, listeners);
}
项目:google-guice    文件:ProvisionListenerTest.java   
public void testProvisionIsNotifiedAfterContextsClear() {
  Injector injector = Guice.createInjector(new AbstractModule() {
    @Override
    protected void configure() {
      bindListener(Matchers.any(), new ProvisionListener() {
        @Override
        public <T> void onProvision(ProvisionInvocation<T> provision) {
          Object provisioned = provision.provision();
          if (provisioned instanceof X) {
            ((X)provisioned).init();
          } else if (provisioned instanceof Y) {
            X.createY = false;
            ((Y)provisioned).init();
          }
        }
      });
    }
  });

  X.createY = true;
  X x = injector.getInstance(X.class);
  assertNotSame(x, x.y.x);
  assertFalse("x.ID: " + x.ID + ", x.y.x.iD: " + x.y.x.ID, x.ID == x.y.x.ID);
}
项目:ProjectAres    文件:ContextualProvider.java   
@Override
final public T get() {
    final ProvisionListener.ProvisionInvocation<T> pi = (ProvisionListener.ProvisionInvocation<T>) provisionInvocation.get();
    if(pi == null) {
        return getWithoutContext();
    } else {
        return getFor(pi.getBinding(), pi.getDependencyChain());
    }
}
项目:datakernel    文件:WorkerPoolModule.java   
@Override
protected void configure() {
    workerPoolScope = new WorkerPoolScope();

    Provider<Injector> injectorProvider = getProvider(Injector.class);
    bindListener(new AbstractMatcher<Binding<?>>() {
        @Override
        public boolean matches(Binding<?> binding) {
            return binding.getKey().getTypeLiteral().getRawType() == WorkerPool.class;
        }
    }, new ProvisionListener() {
        @Override
        public <T> void onProvision(ProvisionInvocation<T> provision) {
            WorkerPool workerPool = (WorkerPool) provision.provision();
            workerPool.injector = injectorProvider.get();
            workerPool.poolScope = workerPoolScope;
        }
    });

    bindScope(Worker.class, workerPoolScope);
    bind(Integer.class).annotatedWith(WorkerId.class).toProvider(new Provider<Integer>() {
        @Override
        public Integer get() {
            return workerPoolScope.currentWorkerId;
        }
    });
}
项目:guice    文件:ProvisionListenerStackCallback.java   
public ProvisionListenerStackCallback(Binding<T> binding, List<ProvisionListener> listeners) {
  this.binding = binding;
  if (listeners.isEmpty()) {
    this.listeners = EMPTY_LISTENER;
  } else {
    Set<ProvisionListener> deDuplicated = Sets.newLinkedHashSet(listeners);
    this.listeners = deDuplicated.toArray(new ProvisionListener[deDuplicated.size()]);
  }
}
项目:guice    文件:ProvisionListenerTest.java   
public void testProvisionIsNotifiedAfterContextsClear() {
  Injector injector =
      Guice.createInjector(
          new AbstractModule() {
            @Override
            protected void configure() {
              bindListener(
                  Matchers.any(),
                  new ProvisionListener() {
                    @Override
                    public <T> void onProvision(ProvisionInvocation<T> provision) {
                      Object provisioned = provision.provision();
                      if (provisioned instanceof X) {
                        ((X) provisioned).init();
                      } else if (provisioned instanceof Y) {
                        X.createY = false;
                        ((Y) provisioned).init();
                      }
                    }
                  });
            }
          });

  X.createY = true;
  X x = injector.getInstance(X.class);
  assertNotSame(x, x.y.x);
  assertFalse("x.id: " + x.id + ", x.y.x.id: " + x.y.x.id, x.id == x.y.x.id);
}
项目:guice-old    文件:ProvisionListenerStackCallback.java   
public ProvisionListenerStackCallback(Binding<T> binding, List<ProvisionListener> listeners) {
  this.binding = binding;
  if (listeners.isEmpty()) {
    this.listeners = EMPTY_LISTENER;
  } else {
    Set<ProvisionListener> deDuplicated = Sets.newLinkedHashSet(listeners);
    this.listeners = deDuplicated.toArray(new ProvisionListener[deDuplicated.size()]);
  }
}
项目:google-guice    文件:ProvisionListenerStackCallback.java   
public ProvisionListenerStackCallback(Binding<T> binding, List<ProvisionListener> listeners) {
  this.binding = binding;
  if (listeners.isEmpty()) {
    this.listeners = EMPTY_LISTENER;
  } else {
    this.listeners = listeners.toArray(new ProvisionListener[listeners.size()]);
  }
}
项目:ProjectAres    文件:Binders.java   
/**
 * Adapt a {@link Consumer} to be a {@link ProvisionListener} (which is not lambda compatible)
 */
static ProvisionListener provisionListener(Consumer<ProvisionListener.ProvisionInvocation<?>> consumer) {
    return consumer::accept;
}
项目:ProjectAres    文件:Binders.java   
/**
 * Adapt the given matcher and listener and pass them to {@link Binder#bindListener(Matcher, ProvisionListener...)}
 */
default void bindProvisionListener(Predicate<? super Binding<?>> matcher, Consumer<ProvisionListener.ProvisionInvocation<?>> listener) {
    bindListener(Matchers.predicate(matcher), provisionListener(listener));
}
项目:ProjectAres    文件:Binders.java   
default <T> void bindProvisionSubtypesOfListener(TypeLiteral<T> type, Consumer<ProvisionListener.ProvisionInvocation<T>> listener) {
    bindProvisionListener(bindingsForSubtypesOf(type), (Consumer) listener);
}
项目:ProjectAres    文件:Binders.java   
default <T> void bindProvisionSubtypesOfListener(Class<T> type, Consumer<ProvisionListener.ProvisionInvocation<T>> listener) {
    bindProvisionSubtypesOfListener(TypeLiteral.get(type), listener);
}
项目:ProjectAres    文件:InjectionLogger.java   
@Override
protected void configure() {
    final InjectionLogger listener = new InjectionLogger(logger);
    bindListener(Matchers.any(), (TypeListener) listener);
    bindListener(Matchers.any(), (ProvisionListener) listener);
}
项目:violet    文件:ForwardingBinder.java   
@Override
default void bindListener(final Matcher<? super Binding<?>> bindingMatcher, final ProvisionListener... listeners) {
  this.binder().bindListener(bindingMatcher, listeners);
}
项目:salta    文件:AbstractModule.java   
/**
 * @see Binder#bindListener(Matcher, ProvisionListener...)
 * @since 4.0
 */
protected void bindListener(Matcher<? super TypeToken<?>> typeMatcher,
        ProvisionListener... listener) {
    binder().bindListener(typeMatcher, listener);
}
项目:loginject    文件:GuiceLogInjectionService.java   
private Module getBindings(LogInject<_Logger_> logInject, Class<_Logger_> loggerClass)
{
    TypeLiteral<_Logger_> loggerType = TypeLiteral.get(loggerClass);
    GuiceLoggerProvider<_Logger_> provider = new GuiceLoggerProvider<>();
    Predicate<Dependency<?>> matchesLogger = dependency -> loggerType.equals(dependency.getKey().getTypeLiteral());
    return new AbstractModule()
    {
        @Override
        protected void configure()
        {
            ProvisionListener provisionListener = new ProvisionListener()
            {
                @Override
                public <_Target_> void onProvision(ProvisionInvocation<_Target_> provision)
                {
                    Binding<_Target_> binding = provision.getBinding();
                    if (loggerType.equals(binding.getKey().getTypeLiteral()))
                    {
                        Dependency<?> loggerDependency;
                        Stream<Dependency<?>> stream;
                        stream = provision.getDependencyChain().stream().map(DependencyAndSource::getDependency);
                        Iterator<Dependency<?>> dependencies = reverse(stream.collect(toList())).iterator();
                        if (dependencies.hasNext() && matchesLogger.test(loggerDependency = dependencies.next()))
                        {
                            InjectionPoint injectionPoint = loggerDependency.getInjectionPoint();
                            TypeLiteral<?> declaringType = injectionPoint.getDeclaringType();
                            TypeLiteral<?> targetType = null;
                            if (dependencies.hasNext())
                            {
                                TypeLiteral<?> typeLiteral = dependencies.next().getKey().getTypeLiteral();
                                if (declaringType.getRawType().isAssignableFrom(typeLiteral.getRawType()))
                                {
                                    targetType = typeLiteral;
                                }
                            }
                            Class<?> logger = (targetType != null? targetType:declaringType).getRawType();
                            BindingTargetVisitor<_Target_, Void> bindingTargetVisitor;
                            bindingTargetVisitor = new DefaultBindingTargetVisitor<_Target_, Void>()
                            {
                                @Override
                                public Void visit(ProviderInstanceBinding<? extends _Target_> instanceBinding)
                                {
                                    if (provider.equals(instanceBinding.getUserSuppliedProvider()))
                                    {
                                        provider.setLogger(logInject.createLogger(logger));
                                    }
                                    return null;
                                }
                            };
                            binding.acceptTargetVisitor(bindingTargetVisitor);
                        }
                    }
                }
            };
            bind(loggerClass).toProvider(provider);
            bindListener(Matchers.any(), provisionListener);
        }
    };
}
项目:guice    文件:PrivateModule.java   
/**
 * @see Binder#bindListener(Matcher, ProvisionListener...)
 * @since 4.0
 */
protected void bindListener(
    Matcher<? super Binding<?>> bindingMatcher, ProvisionListener... listeners) {
  binder().bindListener(bindingMatcher, listeners);
}
项目:guice    文件:AbstractModule.java   
/**
 * @see Binder#bindListener(Matcher, ProvisionListener...)
 * @since 4.0
 */
protected void bindListener(
    Matcher<? super Binding<?>> bindingMatcher, ProvisionListener... listener) {
  binder().bindListener(bindingMatcher, listener);
}
项目:guice    文件:ProvisionListenerTest.java   
@SuppressWarnings("unchecked")
public void testDependencyChain() {
  final List<Class<?>> pList = Lists.newArrayList();
  final List<Class<?>> totalList = Lists.newArrayList();
  Injector injector =
      Guice.createInjector(
          new AbstractModule() {
            @Override
            protected void configure() {
              bind(Instance.class).toInstance(new Instance());
              bind(B.class).to(BImpl.class);
              bind(D.class).toProvider(DP.class);

              bindListener(
                  Matchers.any(),
                  new ProvisionListener() {
                    @Override
                    public <T> void onProvision(ProvisionInvocation<T> provision) {
                      totalList.add(provision.getBinding().getKey().getRawType());
                    }
                  });

              // Build up a list of asserters for our dependency chains.
              ImmutableList.Builder<Class<?>> chain = ImmutableList.builder();
              chain.add(Instance.class);
              bindListener(keyMatcher(Instance.class), new ChainAsserter(pList, chain.build()));

              chain.add(A.class);
              bindListener(keyMatcher(A.class), new ChainAsserter(pList, chain.build()));

              chain.add(B.class).add(BImpl.class);
              bindListener(keyMatcher(BImpl.class), new ChainAsserter(pList, chain.build()));

              chain.add(C.class);
              bindListener(keyMatcher(C.class), new ChainAsserter(pList, chain.build()));

              // the chain has D before DP even though DP is provisioned & notified first
              // because we do DP because of D, and need DP to provision D.
              chain.add(D.class).add(DP.class);
              bindListener(keyMatcher(D.class), new ChainAsserter(pList, chain.build()));
              bindListener(keyMatcher(DP.class), new ChainAsserter(pList, chain.build()));

              chain.add(E.class);
              bindListener(keyMatcher(E.class), new ChainAsserter(pList, chain.build()));

              chain.add(F.class);
              bindListener(keyMatcher(F.class), new ChainAsserter(pList, chain.build()));
            }

            @Provides
            C c(D d) {
              return new C() {};
            }
          });
  injector.getInstance(Instance.class);
  // make sure we're checking all of the chain asserters..
  assertEquals(
      of(Instance.class, A.class, BImpl.class, C.class, DP.class, D.class, E.class, F.class),
      pList);
  // and make sure that nothing else was notified that we didn't expect.
  assertEquals(totalList, pList);
}
项目:guice-old    文件:PrivateModule.java   
/**
 * @see Binder#bindListener(Matcher, ProvisionListener...)
 */
protected void bindListener(Matcher<? super Binding<?>> bindingMatcher,
    ProvisionListener... listeners) {
  binder().bindListener(bindingMatcher, listeners);
}
项目:guice-old    文件:AbstractModule.java   
/**
 * @see Binder#bindListener(Matcher, ProvisionListener...)
 * @since 4.0
 */
protected void bindListener(Matcher<? super Binding<?>> bindingMatcher,
    ProvisionListener... listener) {
  binder().bindListener(bindingMatcher, listener);
}
项目:guice-old    文件:ProvisionListenerTest.java   
@SuppressWarnings("unchecked")
public void testDependencyChain() {
  final List<Class<?>> pList = Lists.newArrayList();
  final List<Class<?>> totalList = Lists.newArrayList();
  Injector injector = Guice.createInjector(new AbstractModule() {
    @Override
    protected void configure() {
      bind(Instance.class).toInstance(new Instance());
      bind(B.class).to(BImpl.class);
      bind(D.class).toProvider(DP.class);

      bindListener(Matchers.any(), new ProvisionListener() {
        public <T> void onProvision(ProvisionInvocation<T> provision) {
          totalList.add(provision.getBinding().getKey().getRawType());
        }
      });

      // Build up a list of asserters for our dependency chains.
      ImmutableList.Builder<Class<?>> chain = ImmutableList.builder();
      chain.add(Instance.class);
      bindListener(keyMatcher(Instance.class), new ChainAsserter(pList, chain.build()));

      chain.add(A.class);
      bindListener(keyMatcher(A.class), new ChainAsserter(pList, chain.build()));

      chain.add(B.class).add(BImpl.class);
      bindListener(keyMatcher(BImpl.class), new ChainAsserter(pList, chain.build()));

      chain.add(C.class);
      bindListener(keyMatcher(C.class), new ChainAsserter(pList, chain.build()));

      // the chain has D before DP even though DP is provisioned & notified first
      // because we do DP because of D, and need DP to provision D.
      chain.add(D.class).add(DP.class);
      bindListener(keyMatcher(D.class), new ChainAsserter(pList, chain.build()));
      bindListener(keyMatcher(DP.class), new ChainAsserter(pList, chain.build()));

      chain.add(E.class);
      bindListener(keyMatcher(E.class), new ChainAsserter(pList, chain.build()));

      chain.add(F.class);
      bindListener(keyMatcher(F.class), new ChainAsserter(pList, chain.build()));
    }
    @Provides C c(D d) {
      return new C() {};
    }
  });
  Instance instance = injector.getInstance(Instance.class);
  // make sure we're checking all of the chain asserters..
  assertEquals(
      of(Instance.class, A.class, BImpl.class, C.class, DP.class, D.class, E.class, F.class),
      pList);
  // and make sure that nothing else was notified that we didn't expect.
  assertEquals(totalList, pList);
}
项目:google-guice    文件:AbstractModule.java   
/**
 * @see Binder#bindListener(Matcher, ProvisionListener...)
 * @since 4.0
 */
protected void bindListener(Matcher<? super Binding<?>> bindingMatcher,
    ProvisionListener... listener) {
  binder().bindListener(bindingMatcher, listener);
}
项目:google-guice    文件:ProvisionListenerTest.java   
@SuppressWarnings("unchecked")
public void testDependencyChain() {
  final List<Class<?>> pList = Lists.newArrayList();
  final List<Class<?>> totalList = Lists.newArrayList();
  Injector injector = Guice.createInjector(new AbstractModule() {
    @Override
    protected void configure() {
      bind(Instance.class).toInstance(new Instance());
      bind(B.class).to(BImpl.class);
      bind(D.class).toProvider(DP.class);

      bindListener(Matchers.any(), new ProvisionListener() {
        public <T> void onProvision(ProvisionInvocation<T> provision) {
          totalList.add(provision.getBinding().getKey().getRawType());
        }
      });

      // Build up a list of asserters for our dependency chains.
      ImmutableList.Builder<Class<?>> chain = ImmutableList.builder();
      chain.add(Instance.class);
      bindListener(keyMatcher(Instance.class), new ChainAsserter(pList, chain.build()));

      chain.add(A.class);
      bindListener(keyMatcher(A.class), new ChainAsserter(pList, chain.build()));

      chain.add(B.class).add(BImpl.class);
      bindListener(keyMatcher(BImpl.class), new ChainAsserter(pList, chain.build()));

      chain.add(C.class);
      bindListener(keyMatcher(C.class), new ChainAsserter(pList, chain.build()));

      // the chain has D before DP even though DP is provisioned & notified first
      // because we do DP because of D, and need DP to provision D.
      chain.add(D.class).add(DP.class);
      bindListener(keyMatcher(D.class), new ChainAsserter(pList, chain.build()));
      bindListener(keyMatcher(DP.class), new ChainAsserter(pList, chain.build()));

      chain.add(E.class);
      bindListener(keyMatcher(E.class), new ChainAsserter(pList, chain.build()));

      chain.add(F.class);
      bindListener(keyMatcher(F.class), new ChainAsserter(pList, chain.build()));
    }
    @Provides C c(D d) {
      return new C() {};
    }
  });
  Instance instance = injector.getInstance(Instance.class);
  // make sure we're checking all of the chain asserters..
  assertEquals(
      of(Instance.class, A.class, BImpl.class, C.class, DP.class, D.class, E.class, F.class),
      pList);
  // and make sure that nothing else was notified that we didn't expect.
  assertEquals(totalList, pList);
}
项目:salta    文件:Binder.java   
/**
 * Registers listeners for provisioned objects. Guice will notify the
 * listeners just before and after the object is provisioned. Provisioned
 * objects that are also injectable (everything except objects provided
 * through Providers) can also be notified through TypeListeners registered
 * in {@link #bindListener}.
 * 
 * @param bindingMatcher
 *            that matches bindings of provisioned objects the listener
 *            should be notified of
 * @param listeners
 *            for provisioned objects matched by bindingMatcher
 * @since 4.0
 */
void bindListener(Matcher<? super TypeToken<?>> bindingMatcher,
        ProvisionListener... listeners);
项目:guice    文件:Binder.java   
/**
 * Registers listeners for provisioned objects. Guice will notify the listeners just before and
 * after the object is provisioned. Provisioned objects that are also injectable (everything
 * except objects provided through Providers) can also be notified through TypeListeners
 * registered in {@link #bindListener}.
 *
 * @param bindingMatcher that matches bindings of provisioned objects the listener should be
 *     notified of
 * @param listeners for provisioned objects matched by bindingMatcher
 * @since 4.0
 */
void bindListener(Matcher<? super Binding<?>> bindingMatcher, ProvisionListener... listeners);
项目:guice-old    文件:Binder.java   
/**
 * Registers listeners for provisioned objects. Guice will notify the
 * listeners just before and after the object is provisioned. Provisioned
 * objects that are also injectable (everything except objects provided
 * through Providers) can also be notified through TypeListeners registered in
 * {@link #bindListener}.
 * 
 * @param bindingMatcher that matches bindings of provisioned objects the listener
 *          should be notified of
 * @param listeners for provisioned objects matched by bindingMatcher 
 * @since 4.0
 */
void bindListener(Matcher<? super Binding<?>> bindingMatcher, ProvisionListener... listeners);
项目:google-guice    文件:Binder.java   
/**
 * Registers listeners for provisioned objects. Guice will notify the
 * listeners just before and after the object is provisioned. Provisioned
 * objects that are also injectable (everything except objects provided
 * through Providers) can also be notified through TypeListeners registered in
 * {@link #bindListener}.
 * 
 * @param bindingMatcher that matches bindings of provisioned objects the listener
 *          should be notified of
 * @param listeners for provisioned objects matched by bindingMatcher 
 * @since 4.0
 */
void bindListener(Matcher<? super Binding<?>> bindingMatcher, ProvisionListener... listeners);