Creates a snippet that evaluates to an injected instance of the given key,
as produced by the given child.
435538
public static SourceSnippet callChildGetter(final GinjectorBindings childBindings,
      final Key<?> key) {
    return new SourceSnippet() {
      public String getSource(InjectorWriteContext writeContext) {
        return writeContext.callChildGetter(childBindings, key);
      }
    };
  }
407005
public static Jose4jRsaJWK getInstance(String alg, String use, PublicKey publicKey, PrivateKey privateKey, String kid) {

        //String kid = RandomUtils.getRandomAlphaNumeric(KID_LENGTH);
        RSAPublicKey pubKey = (RSAPublicKey) publicKey;
        RSAPrivateKey priKey = (RSAPrivateKey) privateKey;
        Jose4jRsaJWK jwk = new Jose4jRsaJWK(pubKey);

        jwk.setPrivateKey(priKey);
        jwk.setAlgorithm(alg);
        jwk.setKeyId(kid);
        jwk.setUse(use == null ? JwkConstants.sig : use);

        return jwk;
    }
336217
void writeBindingGetter(Key<?> key, Binding binding, GinScope scope,
      List<InjectorMethod> helperMethodsOutput) {
    Context bindingContext = binding.getContext();

    SourceSnippetBuilder getterBuilder = new SourceSnippetBuilder();
    SourceSnippet creationStatements;
    String getter = nameGenerator.getGetterMethodName(key);

    String typeName;
    try {
      typeName = ReflectUtil.getSourceName(key.getTypeLiteral());

      creationStatements = binding.getCreationStatements(nameGenerator, helperMethodsOutput);
    } catch (NoSourceNameException e) {
      errorManager.logError("Error trying to write getter for [%s] -> [%s];"
          + " binding declaration: %s", e, key, binding, bindingContext);
      return;
    }

    // Name of the field that we might need.
    String field = nameGenerator.getSingletonFieldName(key);

    switch (scope) {
      case EAGER_SINGLETON:
        initializeEagerSingletonsBody.append("// Eager singleton bound at:\n");
        appendBindingContextCommentToMethod(bindingContext, initializeEagerSingletonsBody);
        initializeEagerSingletonsBody.append(getter).append("();\n");
        // !break
        //CHECKSTYLE_OFF
      case SINGLETON:
        //CHECKSTYLE_OFF
        writer.println("private " + typeName + " " + field + " = null;");
        writer.println();
        getterBuilder.append(String.format("\nif (%s == null) {\n", field))
            .append(creationStatements).append("\n")
            .append(String.format("    %s = result;\n", field))
            .append("}\n")
            .append(String.format("return %s;\n", field));
        break;

      case NO_SCOPE:
        sourceWriteUtil.writeBindingContextJavadoc(writer, bindingContext, key);

        getterBuilder.append(creationStatements).append("\n").append("return result;\n");
        break;

      default:
        throw new IllegalStateException();
    }

    outputMethod(SourceSnippets.asMethod(false, String.format("public %s %s()", typeName, getter),
        fragmentPackageName.toString(), getterBuilder.build()));
  }
297320
private void createIncompleteKey(Key parent) {
    String kind = entityMetadata.getKind();
    if (parent == null) {
      key = entityManager.newNativeKeyFactory().setKind(kind).newKey();
    } else {
      key = IncompleteKey.newBuilder(parent, kind).build();
    }
  }
593762
private void ensureAccessible(Key<?> key, GinjectorBindings parent, GinjectorBindings child) {
    // Parent will be null if it is was an optional dependency and it couldn't be created.
    if (parent != null && !child.equals(parent) && !child.isBound(key)) {
      PrettyPrinter.log(logger, TreeLogger.DEBUG,
          "In %s: inheriting binding for %s from the parent %s", child, key, parent);
      Context context = Context.format("Inheriting %s from parent", key);

      // We don't strictly need all the extra checks in addBinding, but it can't hurt.  We know, for
      // example, that there will not be any unresolved bindings for this key.
      child.addBinding(key, bindingFactory.getParentBinding(key, parent, context));
    }
  }
110228
function Child(file) {
  if (!(this instanceof Child))
    return new Child(file);

  EventEmitter.call(this);

  bindExit();
  children.add(this);

  this.init(file);
}
323650
def create(self, key, *args, **kwargs):
        
        instance = self._class(key, *args, **kwargs)
        self._events.create.trigger(list=self, instance=instance, key=key, args=args, kwargs=kwargs)
        return self.insert(instance)
930961
public void createKey(HKey hk, String key) throws RegistryException {
		int[] ret;
		try {
			ret = ReflectedMethods.createKey(hk.root(), hk.hex(), key);
		} catch (Exception e) {
			throw new RegistryException("Cannot create key " + key, e);
		}
		if (ret.length == 0) {
			throw new RegistryException("Cannot create key " + key + ". Zero return length");
		}
		if (ret[1] != RC.SUCCESS) {
			throw new RegistryException("Cannot create key " + key + ". Return code is " + ret[1]);
		}
	}
192778
public static Description describeChild(Object target, Object child) {
        Object runner = getRunnerForTarget(target);
        return invoke(runner, "describeChild", child);
    }
1205951
@SuppressWarnings("unchecked")
    public T cloneObject(String key) {
        if (this.objects.containsKey(key)) {
            T object = this.objects.get(key);
            if (object != null) {
                try {
                    return (T) object.clone();
                } catch (Exception ex) {
                    throw new RuntimeException(ex);
                }
            }
            return null;
        }
        throw new RuntimeException("[cloning error] object by name <" + key
                + "> not registered in " + getClass().getSimpleName());
    }
214988
public static <K1, K2, V> ImmutableMap<K2, V> copyWithKeysTransformedByInjection(
      final Map<K1, V> map, final Function<? super K1, K2> injection) {
    final ImmutableMap.Builder<K2, V> ret = ImmutableMap.builder();
    for (final Map.Entry<K1, V> entry : map.entrySet()) {
      ret.put(injection.apply(entry.getKey()), entry.getValue());
    }
    return ret.build();
  }
27281
def clone(self, **kwargs):
        '''
        
        '''
        child = ChildContextDict(parent=self, threadsafe=self._threadsafe, overrides=kwargs)
        return child
248185
private static <K, V> HamtPMap<K, V>[] insertChild(
      HamtPMap<K, V>[] children, int index, HamtPMap<K, V> child) {
    @SuppressWarnings("unchecked") // only used internally.
    HamtPMap<K, V>[] newChildren = (HamtPMap<K, V>[]) new HamtPMap<?, ?>[children.length + 1];
    newChildren[index] = child;
    System.arraycopy(children, 0, newChildren, 0, index);
    System.arraycopy(children, index, newChildren, index + 1, children.length - index);
    return newChildren;
  }
379047
@Override
	public Object setChild(final String key, final Controller<M, V> controller)
	{
		if (null != controller.getParent())
		{
			// controller.getParent().re
		}
		return children.put(key, controller);
	}
899008
private void addConstructorByKeyRef() {
    context.constructorByKeyRef = MethodSpec.constructorBuilder().addParameter(keyRefSpec);
    addCommonParameters(context.constructorByKeyRef);
    if (isBaseClass()) {
      assignKeyRefAndValue();
    } else {
      callParentByKeyRef();
    }
  }
691616
def insert(self, key):
        
        # Create new node
        n = TreeNode(key)
        if not self.node:
            self.node = n
            self.node.left = AvlTree()
            self.node.right = AvlTree()
        elif key < self.node.val:
            self.node.left.insert(key)
        elif key > self.node.val:
            self.node.right.insert(key)
        self.re_balance()
806091
@Override
	public Controller<M, V> removeChild(final String key)
	{
		return children.remove(key);
	}