StringBuilder initializeEagerSingletonsBody = new StringBuilder();
// Collects the text of the body of initializeStaticInjections().
StringBuilder initializeStaticInjectionsBody = new StringBuilder();
SourceWriteUtil sourceWriteUtil = sourceWriteUtilFactory.create(bindings);
// Output child modules.
for (GinjectorBindings child : bindings.getChildren()) {
String className = ginjectorNameGenerator.getClassName(child);
String canonicalClassName = ginjectorNameGenerator.getCanonicalClassName(child);
String fieldName = ginjectorNameGenerator.getFieldName(child);
String getterName = nameGenerator.getChildInjectorGetterMethodName(className);
writer.beginJavaDocComment();
writer.print("Child injector for %s", child.getModule());
writer.endJavaDocComment();
writer.println("private %s %s = null;", canonicalClassName, fieldName);
writer.beginJavaDocComment();
writer.print("Getter for child injector for %s", child.getModule());
writer.endJavaDocComment();
sourceWriteUtil.writeMethod(writer,
String.format("public %s %s()", canonicalClassName, getterName),
String.format(
"if (%2$s == null) {\n"
+ " %2$s = new %1$s(this);\n"
+ "}\n\n"