Tabnine Logo
LinkedKeyBinding
Code IndexAdd Tabnine to your IDE (free)

How to use
LinkedKeyBinding
in
com.google.inject.spi

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

origin: com.google.inject/guice

@Override
public Indexer.IndexedBinding visit(LinkedKeyBinding<? extends Object> binding) {
 return new Indexer.IndexedBinding(
   binding, BindingType.LINKED_KEY, scope(binding), binding.getLinkedKey());
}
origin: com.google.inject.extensions/guice-grapher

/**
 * Visitor for {@link LinkedKeyBinding}. This is the standard {@link Binding} you get from
 * binding an interface class to an implementation class. We draw a {@link BindingEdge} from the
 * interface node to the node of the implementing class.
 */
@Override
public Collection<Edge> visit(LinkedKeyBinding<?> binding) {
 return ImmutableList.<Edge>of(
   new BindingEdge(
     NodeId.newTypeId(binding.getKey()),
     NodeId.newTypeId(binding.getLinkedKey()),
     BindingEdge.Type.NORMAL));
}
origin: info.magnolia.ui/magnolia-ui-framework

.onLinkedBinding(linkedKeyBinding -> linkedKeyBinding.getLinkedKey().getTypeLiteral().getRawType())
.onProviderKeyBinding(providerKeyBinding -> providerKeyBinding.getProviderKey().getTypeLiteral().getRawType())
.visit()
    bind(linkedKeyBinding.getKey())
        .toProvider(() -> Components.newInstance(linkedKeyBinding.getLinkedKey().getTypeLiteral().getRawType()))
        .in(relatedScope);
  })
origin: com.google.inject/guice

@Override
public Boolean visit(LinkedKeyBinding<? extends T> binding) {
 prepareBinding();
 Key<? extends T> linkedKey = binding.getLinkedKey();
 if (key.equals(linkedKey)) {
  errors.recursiveBinding();
 }
 FactoryProxy<T> factory = new FactoryProxy<>(injector, key, linkedKey, source);
 bindingData.addCreationListener(factory);
 InternalFactory<? extends T> scopedFactory =
   Scoping.scope(key, injector, factory, source, scoping);
 putBinding(
   new LinkedBindingImpl<T>(injector, key, source, scopedFactory, scoping, linkedKey));
 return true;
}
origin: info.magnolia.ui/magnolia-ui-framework

  final Key linkedKey = binding.getLinkedKey();
  final Key sourceKey = Key.get(typeLiteral);
.consumeLinkedBinding(linkedKeyBinding -> {
  if (Objects.equals(typeLiteral.getRawType(), linkedKeyBinding.getLinkedKey().getTypeLiteral().getRawType())) {
    elementsToWrite.remove(linkedKeyBinding);
    bindNonAbstractType(linkedKeyBinding.getKey(), GuiceSpi.resolveScope(linkedKeyBinding));
origin: com.google.inject.extensions/guice-grapher

@Override
public Collection<Key<?>> visit(LinkedKeyBinding<?> binding) {
 return ImmutableSet.<Key<?>>of(binding.getLinkedKey());
}
origin: com.netflix.governator/governator-test

@Override
public Void visit(LinkedKeyBinding<? extends T> binding) {
  builder.to(binding.getLinkedKey()).in(Scopes.SINGLETON);
  return null;
}
origin: com.atlassian.org.eclipse.sisu/org.eclipse.sisu.inject

@Override
public Class<?> visit( final LinkedKeyBinding<?> binding )
{
  // this assumes only one level of indirection: api-->impl
  return binding.getLinkedKey().getTypeLiteral().getRawType();
}
origin: ArcBees/Jukito

@Override
public Void visit(LinkedKeyBinding<? extends T> linkedKeyBinding) {
  return addBindingKey(linkedKeyBinding, linkedKeyBinding.getLinkedKey());
}
origin: org.jukito/jukito

@Override
public Void visit(LinkedKeyBinding<? extends T> linkedKeyBinding) {
  return addBindingKey(linkedKeyBinding, linkedKeyBinding.getLinkedKey());
}
origin: org.sonatype.sisu/sisu-guice

@Override
public Indexer.IndexedBinding visit(LinkedKeyBinding<? extends Object> binding) {
 return new Indexer.IndexedBinding(
   binding, BindingType.LINKED_KEY, scope(binding), binding.getLinkedKey());
}
origin: com.jwebmp.inject/guice

@Override
public Indexer.IndexedBinding visit(LinkedKeyBinding<? extends Object> binding) {
 return new Indexer.IndexedBinding(
   binding, BindingType.LINKED_KEY, scope(binding), binding.getLinkedKey());
}
origin: org.xbib/guice

@Override
public IndexedBinding visit(LinkedKeyBinding<? extends Object> binding) {
  return new IndexedBinding(binding, BindingType.LINKED_KEY, scope(binding),
      binding.getLinkedKey());
}
origin: matsim-org/matsim

public static void printInjector(com.google.inject.Injector injector, Logger log) {
  Level level = Level.INFO ;
  log.log(level,"=== printInjector start ===") ;
  for (Map.Entry<Key<?>, Binding<?>> entry : injector.getBindings().entrySet()) {
    if ( entry.getKey().toString().contains("type=org.matsim") ) {
      Annotation annotation = entry.getKey().getAnnotation();
      log.log( level, entry.getKey().getTypeLiteral() + " " + (annotation != null ? annotation.toString() : ""));
      log.log(level, "  --> provider: " + entry.getValue().getProvider());
      log.log(level, "  --> source: " + entry.getValue().getSource() );
      if ( entry.getValue() instanceof BindingImpl ) {
        log.log( level, "  --> scope: " + ((BindingImpl<?>)entry.getValue()).getScoping() ) ;
      }
      if ( entry.getValue() instanceof LinkedKeyBinding) {
        log.log( level, "  --> target: " + ((LinkedKeyBinding) entry.getValue()).getLinkedKey() ) ;
      }
      log.log(level, "  ==full==> " + entry.getValue() );
      // yy could probably format the above in a better way. kai, may'16
      log.log(level,  "" );
    }
  }
  log.log(level,"=== printInjector end ===") ;
}
origin: io.github.gwtplus.gin/gin

public Void visit(LinkedKeyBinding<? extends T> linkedKeyBinding) {
 Context context = Context.forElement(linkedKeyBinding);
 bindingsCollection.addBinding(targetKey,
   bindingFactory.getBindClassBinding(linkedKeyBinding.getLinkedKey(), targetKey, context));
 return null;
}
origin: com.atlassian.org.eclipse.sisu/org.eclipse.sisu.inject

@Override
public Boolean visit( final LinkedKeyBinding<?> binding )
{
  final Key<?> linkedKey = binding.getLinkedKey();
  if ( linkedKey.getAnnotationType() == null )
  {
    return analyzeImplementation( linkedKey.getTypeLiteral(), true );
  }
  return Boolean.TRUE; // indirect binding, don't scan
}
origin: com.atlassian.org.eclipse.sisu/org.eclipse.sisu.inject

@Override
public Boolean visit( final LinkedKeyBinding<?> binding )
{
  final Key<?> linkedKey = binding.getLinkedKey();
  if ( linkedKey.getAnnotationType() == null )
  {
    return verifyImplementation( linkedKey.getTypeLiteral() );
  }
  return Boolean.TRUE; // indirect binding, don't scan
}
origin: info.magnolia.ui/magnolia-ui-framework

@Override
@SuppressWarnings("unchecked")
protected void configure() {
  final List<Element> elements = Elements.getElements(sourceModule);
  final List<Element> elementsToWrite = new ArrayList<>(elements);
  GuiceSpi.getBindings(elements).forEach(binding -> {
    final Scoping scoping = GuiceSpi.resolveScope(binding);
    if (scoping == null) {
      return;
    }
    final Class<? extends Annotation> scopeAnnotation = scoping.getScopeAnnotation();
    if (isSingletonScopeAnnotation(scopeAnnotation)) {
      boolean isEagerSingleton = isEagerSingletonAnnotation(scopeAnnotation);
      final UiContextAnnotation uiContextAnnotation = UiAnnotations.cast(binding.getKey().getAnnotation());
      final Class<? extends Annotation> relatedScopeAnnotation = uiContextAnnotation.getRelatedScopeAnnotation(isEagerSingleton);
      if (!Objects.equals(relatedScopeAnnotation, scopeAnnotation)) {
        elementsToWrite.remove(binding);
        final Key key = binding.getKey();
        GuiceSpi.<ScopedBindingBuilder>inspect(binding)
            .onLinkedBinding(linkedKeyBinding -> bind(key).to(linkedKeyBinding.getLinkedKey()))
            .onProviderKeyBinding(providerBinding -> bind(key).toProvider(providerBinding.getProviderKey()))
            .visit()
            .ifPresent(scopedBindingBuilder -> scopedBindingBuilder.in(relatedScopeAnnotation));
      }
    }
  });
  elementsToWrite.forEach(element -> element.applyTo(binder()));
}
origin: Nextdoor/bender

public Boolean visit(LinkedKeyBinding<? extends T> binding) {
 prepareBinding();
 Key<? extends T> linkedKey = binding.getLinkedKey();
 if (key.equals(linkedKey)) {
  errors.recursiveBinding();
 }
 FactoryProxy<T> factory = new FactoryProxy<T>(injector, key, linkedKey, source);
 bindingData.addCreationListener(factory);
 InternalFactory<? extends T> scopedFactory
   = Scoping.scope(key, injector, factory, source, scoping);
 putBinding(
   new LinkedBindingImpl<T>(injector, key, source, scopedFactory, scoping, linkedKey));
 return true;
}
origin: com.google/inject

public Boolean visit(LinkedKeyBinding<? extends T> binding) {
 prepareBinding();
 Key<? extends T> linkedKey = binding.getLinkedKey();
 if (key.equals(linkedKey)) {
  errors.recursiveBinding();
 }
 FactoryProxy<T> factory = new FactoryProxy<T>(injector, key, linkedKey, source);
 bindingData.addCreationListener(factory);
 InternalFactory<? extends T> scopedFactory
   = Scoping.scope(key, injector, factory, source, scoping);
 putBinding(
   new LinkedBindingImpl<T>(injector, key, source, scopedFactory, scoping, linkedKey));
 return true;
}
com.google.inject.spiLinkedKeyBinding

Javadoc

A binding to a linked key. The other key's binding is used to resolve injections.

Most used methods

  • getLinkedKey
    Returns the linked key used to resolve injections. That binding can be retrieved from an injector us
  • getKey

Popular in Java

  • Finding current android device location
  • findViewById (Activity)
  • scheduleAtFixedRate (Timer)
  • requestLocationUpdates (LocationManager)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Best plugins for Eclipse
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