Package com.google.inject

Examples of com.google.inject.Key$SimpleKey


  public Boolean visit(PrivateElements paramPrivateElements)
  {
    Iterator localIterator = paramPrivateElements.getExposedKeys().iterator();
    while (localIterator.hasNext())
    {
      Key localKey = (Key)localIterator.next();
      bindExposed(paramPrivateElements, localKey);
    }
    return Boolean.valueOf(false);
  }
View Full Code Here


  {
    if (paramBindingImpl.getScoping().isEagerSingleton(paramStage))
      return true;
    if ((paramBindingImpl instanceof LinkedBindingImpl))
    {
      Key localKey = ((LinkedBindingImpl)paramBindingImpl).getLinkedKey();
      return isEagerSingleton(paramInjectorImpl, paramInjectorImpl.getBinding(localKey), paramStage);
    }
    return false;
  }
View Full Code Here

    return new UntargettedBindingImpl(paramInjectorImpl, paramKey, paramObject);
  }

  protected void putBinding(BindingImpl paramBindingImpl)
  {
    Key localKey = paramBindingImpl.getKey();
    Class localClass = localKey.getTypeLiteral().getRawType();
    if (FORBIDDEN_TYPES.contains(localClass))
    {
      this.errors.cannotBindToGuiceType(localClass.getSimpleName());
      return;
    }
View Full Code Here

    this.member = paramField;
    this.declaringType = paramTypeLiteral;
    this.optional = paramBoolean;
    Annotation[] arrayOfAnnotation = paramField.getAnnotations();
    Errors localErrors = new Errors(paramField);
    Key localKey = null;
    try
    {
      localKey = Annotations.getKey(paramTypeLiteral.getFieldType(paramField), paramField, arrayOfAnnotation, localErrors);
    }
    catch (ConfigurationException localConfigurationException)
View Full Code Here

      boolean contains = mapbinder.containsElement(element);
      if(!contains) {
        otherElements.add(element);
      }
      boolean matched = false;
      Key key = null;
      Binding b = null;
      if(element instanceof Binding) {
        b = (Binding)element;
        key = b.getKey();
        Object visited = b.acceptTargetVisitor(visitor);
        if(visited instanceof MapBinderBinding) {
          matched = true;
          if(visited.equals(mapbinder)) {
            assertTrue(contains);
          } else {
            otherMapBindings.add(visited);
          }
        }
      } else if(element instanceof ProviderLookup) {
        key = ((ProviderLookup)element).getKey();
      }
     
      if(!matched && key != null) {
        if(key.equals(mapOfProvider)) {
          matched = true;
          assertTrue(contains);
          mapProviderMatch = true;
        } else if(key.equals(mapOfSet)) {
          matched = true;
          assertTrue(contains);
          mapSetMatch = true;
        } else if(key.equals(mapOfSetOfProvider)) {
          matched = true;
          assertTrue(contains);
          mapSetProviderMatch = true;
        } else if(key.equals(setOfEntry)) {
          matched = true;
          assertTrue(contains);
          entrySetMatch = true;
          // Validate that this binding is also a MultibinderBinding.
          if(b != null) {
View Full Code Here

    for (Element element : elements) {
      boolean contains = optionalBinder.containsElement(element);
      if (!contains) {
        nonContainedElements.add(element);
      }
      Key key = null;
      Binding b = null;
      if (element instanceof Binding) {
        b = (Binding) element;
        key = b.getKey();
        Object visited = b.acceptTargetVisitor(visitor);
        if (visited instanceof OptionalBinderBinding) {
          if (visited.equals(optionalBinder)) {
            assertTrue(contains);
          } else {
            otherOptionalElements.add(visited);
          }
        }
      } else if (element instanceof ProviderLookup) {
        key = ((ProviderLookup) element).getKey();
      }

      if (key != null && key.equals(keyType)) {
        // keyType might match because a user bound it
        // (which is possible in a purely absent OptionalBinder)
        assertEquals(expectedDefault != null || expectedActual != null, contains);
        if (contains) {
          keyMatch = true;
        }
      } else if (key != null && key.equals(optionalKey)) {
        assertTrue(contains);
        optionalKeyMatch = true;
      } else if (key != null && key.equals(optionalJavaxProviderKey)) {
        assertTrue(contains);
        optionalJavaxProviderKeyMatch = true;
      } else if (key != null && key.equals(optionalProviderKey)) {
        assertTrue(contains);
        optionalProviderKeyMatch = true;
      } else if (key != null && key.equals(sourceMapKey)) {
        assertTrue(contains);
        mapBindingMatch = true;
        // Validate that this binding is also a MapBinding.
        assertEquals(mapbinderBinding, b.acceptTargetVisitor(visitor));
      } else if (key != null && key.equals(defaultKey)) {
        assertTrue(contains);
        if (b != null) { // otherwise it might just be a ProviderLookup into it
          assertTrue("expected: " + expectedDefault + ", but was: " + b,
              matches(b, expectedDefault));
          defaultMatch = true;
        }
      } else if (key != null && key.equals(actualKey)) {
        assertTrue(contains);
        if (b != null) { // otherwise it might just be a ProviderLookup into it
          assertTrue("expected: " + expectedActual + ", but was: " + b, matches(b, expectedActual));
          actualMatch = true;
        }
View Full Code Here

      });
     
      // The map this exposes is internally an ImmutableMap, so it's OK to massage
      // the guice Provider to javax Provider in the value (since Guice provider
      // implements javax Provider).
      @SuppressWarnings("unchecked")
      Key massagedProviderMapKey = (Key)providerMapKey;
      binder.bind(javaxProviderMapKey).to(massagedProviderMapKey);

      final Provider<Map<K, Provider<V>>> mapProvider = binder.getProvider(providerMapKey);
      binder.bind(mapKey).toProvider(new RealMapWithExtensionProvider<Map<K, V>>(mapKey) {
View Full Code Here

        }
      });
     
      // Optional is immutable, so it's safe to expose Optional<Provider<T>> as
      // Optional<javax.inject.Provider<T>> (since Guice provider implements javax Provider).
      @SuppressWarnings({"unchecked", "cast"})
      Key massagedOptionalProviderKey = (Key) optionalProviderKey;
      binder.bind(optionalJavaxProviderKey).to(massagedOptionalProviderKey);

      binder.bind(optionalKey).toProvider(new RealOptionalKeyProvider());
    }
View Full Code Here

TOP

Related Classes of com.google.inject.Key$SimpleKey

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.