Tabnine Logo
com.google.inject.internal
Code IndexAdd Tabnine to your IDE (free)

How to use com.google.inject.internal

Best Java code snippets using com.google.inject.internal (Showing top 20 results out of 315)

origin: com.google.inject/guice

 @Override
 public void run() {
  try {
   binding.getInjector().initializeBinding(binding, errors.withSource(source));
  } catch (ErrorsException e) {
   errors.merge(e.getErrors());
  }
 }
};
origin: com.google.inject/guice

@Override
public void notify(Errors errors) {
 try {
  providerFactory =
    injector.getInternalFactory(
      providerKey, errors.withSource(source), JitLimitation.NEW_OR_EXISTING_JIT);
 } catch (ErrorsException e) {
  errors.merge(e.getErrors());
 }
}
origin: com.google.inject/guice

 @Override
 public Object load(K key) {
  Errors errors = new Errors();
  V result = null;
  try {
   result = FailableCache.this.create(key, errors);
  } catch (ErrorsException e) {
   errors.merge(e.getErrors());
  }
  return errors.hasErrors() ? errors : result;
 }
});
origin: com.google.inject/guice

private boolean isEagerSingleton(InjectorImpl injector, BindingImpl<?> binding, Stage stage) {
 if (binding.getScoping().isEagerSingleton(stage)) {
  return true;
 }
 // handle a corner case where a child injector links to a binding in a parent injector, and
 // that binding is singleton. We won't catch this otherwise because we only iterate the child's
 // bindings.
 if (binding instanceof LinkedBindingImpl) {
  Key<?> linkedBinding = ((LinkedBindingImpl<?>) binding).getLinkedKey();
  return isEagerSingleton(injector, injector.getBinding(linkedBinding), stage);
 }
 return false;
}
origin: com.google.inject/guice

 private <T> void bindExposed(PrivateElements privateElements, Key<T> key) {
  ExposedKeyFactory<T> exposedKeyFactory = new ExposedKeyFactory<>(key, privateElements);
  bindingData.addCreationListener(exposedKeyFactory);
  putBinding(
    new ExposedBindingImpl<T>(
      injector,
      privateElements.getExposedSource(key),
      key,
      exposedKeyFactory,
      privateElements));
 }
}
origin: com.google.inject/guice

@Override
void doInitialize() {
 BindingImpl<T> targetBinding = bindingSelection.getBinding();
 // we only install this factory if they call setBinding()/setDefault() so we know that
 // targetBinding will be non-null.
 this.targetKey = targetBinding.getKey();
 this.targetSource = targetBinding.getSource();
 this.targetFactory = targetBinding.getInternalFactory();
}
origin: com.google.inject/guice

@Override
protected T doProvision(InternalContext context, Dependency<?> dependency)
  throws InternalProvisionException {
 // This is what linked bindings do (see FactoryProxy), and we are pretty similar.
 context.pushState(targetKey, targetSource);
 try {
  return targetFactory.get(context, dependency, true);
 } catch (InternalProvisionException ipe) {
  throw ipe.addSource(targetKey);
  } finally {
   context.popState();
 }
}
origin: com.google.inject/guice

/**
 * Creates a synthetic binding to {@code Provider<T>}, i.e. a binding to the provider from {@code
 * Binding<T>}.
 */
private <T> BindingImpl<Provider<T>> createProviderBinding(Key<Provider<T>> key, Errors errors)
  throws ErrorsException {
 Key<T> providedKey = getProvidedKey(key, errors);
 BindingImpl<T> delegate = getBindingOrThrow(providedKey, errors, JitLimitation.NO_JIT);
 return new ProviderBindingImpl<T>(this, key, delegate);
}
origin: com.google.inject/guice

T inject(InternalContext context) throws InternalProvisionException {
 Dependency<T> localDependency = dependency;
 Dependency previous = context.pushDependency(localDependency, source);
 try {
  return factory.get(context, localDependency, false);
 } catch (InternalProvisionException ipe) {
  throw ipe.addSource(localDependency);
  } finally {
   context.popStateAndSetDependency(previous);
 }
}
origin: com.google.inject/guice

@Override
public void blacklist(Key<?> key, State state, Object source) {
 parent.blacklist(key, state, source);
 blacklistedKeys.add(key, state, source);
}
origin: com.google.inject/guice

/** Returns an injection point that can be used to clean up the constructor store. */
InjectionPoint getInternalConstructor() {
 if (factory.constructorInjector != null) {
  return factory.constructorInjector.getConstructionProxy().getInjectionPoint();
 } else {
  return constructorInjectionPoint;
 }
}
origin: com.google.inject/guice

 @Override
 public T get(InternalContext context, Dependency<?> dependency, boolean linked)
   throws InternalProvisionException {
  // TODO(lukes): add a source to the thrown exception?
  return delegate.getInternalFactory().get(context, dependency, linked);
 }
}
origin: com.google.inject/guice

@Override
public void initialize(final InjectorImpl injector, final Errors errors) throws ErrorsException {
 originalFactory.source = getSource();
 originalFactory.provisionCallback = injector.provisionListenerStore.get(this);
 // For these kinds of providers, the 'user supplied provider' is really 'guice supplied'
 // So make our user supplied provider just delegate to the guice supplied one.
 originalFactory.delegateProvider = getProvider();
 originalFactory.initialize(injector, errors);
}
origin: com.google.inject/guice

@Override
public void injectMembers(T instance) {
 TypeLiteral<T> localTypeLiteral = typeLiteral;
 try {
  injectAndNotify(instance, null, null, localTypeLiteral, false);
 } catch (InternalProvisionException ipe) {
  throw ipe.addSource(localTypeLiteral).toProvisionException();
 }
}
origin: com.google.inject/guice

@Override
void doInitialize() {
 if (bindingSelection.getBinding() != null) {
  target = bindingSelection.getBinding().getInternalFactory();
  targetDependency = bindingSelection.getDependency();
 }
}
origin: com.google.inject/guice

/**
 * Schedule initialization of this binding to occur immediately after all bindings have been
 * initialially processed.
 */
protected void scheduleInitialization(BindingImpl<?> binding) {
 bindingData.addUninitializedBinding(asRunnable(binding));
}
origin: com.google.inject/guice

/**
 * Returns the key to use for the default binding.
 *
 * <p>As a side effect this installs support for the 'direct type', so a binding for {@code T}
 * will be made available.
 */
Key<T> getKeyForDefaultBinding() {
 bindingSelection.checkNotInitialized();
 addDirectTypeBinding(binder);
 return bindingSelection.getKeyForDefaultBinding();
}
origin: com.google.inject/guice

/**
 * Returns the key to use for the actual binding, overrides the default if set.
 *
 * <p>As a side effect this installs support for the 'direct type', so a binding for {@code T}
 * will be made available.
 */
Key<T> getKeyForActualBinding() {
 bindingSelection.checkNotInitialized();
 addDirectTypeBinding(binder);
 return bindingSelection.getKeyForActualBinding();
}
origin: com.google.inject/guice

@Override
public void notify(final Errors errors) {
 try {
  targetFactory =
    injector.getInternalFactory(
      targetKey, errors.withSource(source), JitLimitation.NEW_OR_EXISTING_JIT);
 } catch (ErrorsException e) {
  errors.merge(e.getErrors());
 }
}
origin: com.google.inject/guice

@Override
public T get(InternalContext context, Dependency<?> dependency, boolean linked)
  throws InternalProvisionException {
 context.pushState(providerKey, source);
 try {
  javax.inject.Provider<? extends T> provider = providerFactory.get(context, dependency, true);
  return circularGet(provider, context, dependency, provisionCallback);
 } catch (InternalProvisionException ipe) {
  throw ipe.addSource(providerKey);
  } finally {
   context.popState();
 }
}
com.google.inject.internal

Most used classes

  • Annotations
    Annotation utilities.
  • Errors
    A collection of error messages. If this type is passed as a method parameter, the method is consider
  • MoreTypes
    Static methods for working with types that we aren't publishing in the public Types API.
  • UniqueAnnotations
  • ErrorsException
    Indicates that a result could not be returned while preparing or resolving a binding. The caller sho
  • BindingImpl,
  • Scoping,
  • BytecodeGen,
  • Nullability,
  • ProviderMethodsModule,
  • ProviderMethod,
  • LinkedBindingImpl,
  • InjectorImpl,
  • InternalContext,
  • InternalInjectorCreator,
  • MoreTypes$CompositeType,
  • MoreTypes$GenericArrayTypeImpl,
  • MoreTypes$WildcardTypeImpl,
  • Classes
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now