congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ScopeImpl.installBoundProvider
Code IndexAdd Tabnine to your IDE (free)

How to use
installBoundProvider
method
in
toothpick.ScopeImpl

Best Java code snippets using toothpick.ScopeImpl.installBoundProvider (Showing top 9 results out of 315)

origin: stephanenicolas/toothpick

/**
 * Install the provider of the class {@code clazz} and name {@code bindingName}
 * in the current scope.
 *
 * @param clazz the class for which to install the scoped provider of this scope.
 * @param bindingName the name, possibly {@code null}, for which to install the scoped provider.
 * @param scopedProvider the internal provider to install.
 * @param isTestProvider whether or not is a test provider, installed through a Test Module that should override
 *                       existing providers for the same class-bindingname.
 * @param <T> the type of {@code clazz}.
 * @return the provider that will be installed, if one was previously installed, it is returned, in a lock-free way.
 */
private <T> InternalProviderImpl<? extends T> installScopedProvider(Class<T> clazz, String bindingName,
  ScopedProviderImpl<? extends T> scopedProvider, boolean isTestProvider) {
 return installBoundProvider(clazz, bindingName, scopedProvider, isTestProvider);
}
origin: stephanenicolas/toothpick

/**
 * Install bindings for scope.
 */
private void installBindingForScope() {
 //it's always possible to get access to the scope that contains an injected object.
 installBoundProvider(Scope.class, null, new InternalProviderImpl<>(this), false);
}
origin: stephanenicolas/toothpick

private void installModule(boolean isTestModule, Module module) {
 for (Binding binding : module.getBindingSet()) {
  if (binding == null) {
   throw new IllegalStateException("A module can't have a null binding : " + module);
  }
  Class clazz = binding.getKey();
  String bindingName = binding.getName();
  try {
   if (isTestModule || getBoundProvider(clazz, bindingName) == null) {
    InternalProviderImpl provider = toProvider(binding);
    if (binding.isCreatingInstancesInScope()) {
     installScopedProvider(clazz, bindingName, (ScopedProviderImpl) provider, isTestModule);
    } else {
     installBoundProvider(clazz, bindingName, provider, isTestModule);
    }
   }
  } catch (Exception e) {
   throw new IllegalBindingException(format("Binding %s couldn't be installed", bindingName), e);
  }
 }
}
origin: com.github.stephanenicolas/toothpick-runtime

/**
 * Install the provider of the class {@code clazz} and name {@code bindingName}
 * in the current scope.
 *
 * @param clazz the class for which to install the scoped provider of this scope.
 * @param bindingName the name, possibly {@code null}, for which to install the scoped provider.
 * @param <T> the type of {@code clazz}.
 * @return the provider that will be installed, if one was previously installed, it is returned, in a lock-free way.
 */
private <T> InternalProviderImpl<? extends T> installScopedProvider(Class<T> clazz, String bindingName,
  ScopedProviderImpl<? extends T> scopedProvider) {
 return installBoundProvider(clazz, bindingName, scopedProvider);
}
origin: com.github.stephanenicolas.toothpick/toothpick-runtime

/**
 * Install the provider of the class {@code clazz} and name {@code bindingName}
 * in the current scope.
 *
 * @param clazz the class for which to install the scoped provider of this scope.
 * @param bindingName the name, possibly {@code null}, for which to install the scoped provider.
 * @param scopedProvider the internal provider to install.
 * @param isTestProvider whether or not is a test provider, installed through a Test Module that should override
 *                       existing providers for the same class-bindingname.
 * @param <T> the type of {@code clazz}.
 * @return the provider that will be installed, if one was previously installed, it is returned, in a lock-free way.
 */
private <T> InternalProviderImpl<? extends T> installScopedProvider(Class<T> clazz, String bindingName,
  ScopedProviderImpl<? extends T> scopedProvider, boolean isTestProvider) {
 return installBoundProvider(clazz, bindingName, scopedProvider, isTestProvider);
}
origin: com.github.stephanenicolas/toothpick-runtime

public ScopeImpl(Object name) {
 super(name);
 //it's always possible to get access to the scope that conitains an injected object.
 installBoundProvider(Scope.class, null, new InternalProviderImpl<>(this));
}
origin: com.github.stephanenicolas.toothpick/toothpick-runtime

/**
 * Install bindings for scope.
 */
private void installBindingForScope() {
 //it's always possible to get access to the scope that contains an injected object.
 installBoundProvider(Scope.class, null, new InternalProviderImpl<>(this), false);
}
origin: com.github.stephanenicolas.toothpick/toothpick-runtime

private void installModule(boolean isTestModule, Module module) {
 for (Binding binding : module.getBindingSet()) {
  if (binding == null) {
   throw new IllegalStateException("A module can't have a null binding : " + module);
  }
  Class clazz = binding.getKey();
  String bindingName = binding.getName();
  try {
   if (isTestModule || getBoundProvider(clazz, bindingName) == null) {
    InternalProviderImpl provider = toProvider(binding);
    if (binding.isCreatingInstancesInScope()) {
     installScopedProvider(clazz, bindingName, (ScopedProviderImpl) provider, isTestModule);
    } else {
     installBoundProvider(clazz, bindingName, provider, isTestModule);
    }
   }
  } catch (Exception e) {
   throw new IllegalBindingException(format("Binding %s couldn't be installed", bindingName), e);
  }
 }
}
origin: com.github.stephanenicolas/toothpick-runtime

private void installModule(Module module) {
 for (Binding binding : module.getBindingSet()) {
  if (binding == null) {
   throw new IllegalStateException("A module can't have a null binding : " + module);
  }
  Class clazz = binding.getKey();
  String bindingName = binding.getName();
  if (!hasTestModules || getBoundProvider(clazz, bindingName) == null) {
   InternalProviderImpl provider = toProvider(binding);
   if (binding.isScoped()) {
    installScopedProvider(clazz, bindingName, (ScopedProviderImpl) provider);
   } else {
    installBoundProvider(clazz, bindingName, provider);
   }
  }
 }
}
toothpickScopeImplinstallBoundProvider

Javadoc

Install the provider of the class clazz and name bindingNamein the current scope.

Popular methods of ScopeImpl

  • <init>
  • installModules
  • lookupProvider
    The core of Toothpick internals : the provider lookup. It will look for a scoped provider, bubbling
  • toProvider
  • createInternalProvider
  • getBoundProvider
    Obtains the provider of the class clazz and name bindingName, if any. The returned provider will be
  • getInstance
  • getInternalProvider
    Obtains the provider of the class clazz and name bindingName. The returned provider can either be bo
  • getLazy
  • getName
  • getProvider
  • getRootScope
  • getProvider,
  • getRootScope,
  • getUnBoundProvider,
  • installInternalProvider,
  • installModule,
  • installNamedProvider,
  • installScopedProvider,
  • installUnBoundProvider,
  • installUnNamedProvider

Popular in Java

  • Reading from database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • notifyDataSetChanged (ArrayAdapter)
  • findViewById (Activity)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • String (java.lang)
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Best IntelliJ plugins
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