code: 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()));
    }
docs: Writes a method describing the getter for the given key, along with any
  other code necessary to support it.  Produces a list of helper methods that
  still need to be written.