Package com.google.gwt.inject.rebind.util

Examples of com.google.gwt.inject.rebind.util.SourceWriteUtil


      writer.beginJavaDocComment();
      writer.print("Top-level injector instance for injector " + rootBindings.getModule() + ".");
      writer.endJavaDocComment();
      writer.println("private final %1$s %2$s = new %1$s(this);", rootInjectorClass, rootFieldName);

      SourceWriteUtil sourceWriteUtil = sourceWriteUtilFactory.create(rootBindings);

      String staticInjectionInitialization = rootBindings.hasStaticInjectionRequestInSubtree()
          ? String.format("%s.initializeStaticInjections();\n", rootFieldName)
          : "";

      String eagerSingletonsInitialization = rootBindings.hasEagerSingletonBindingInSubtree()
          ? String.format("%s.initializeEagerSingletons();\n", rootFieldName)
          : "";

      sourceWriteUtil.writeMethod(writer, "public " + implClassName + "()", String.format(
          // To imitate the behavior of Guice and provide more predictable
          // bootstrap ordering, we initialize the injectors in two phases:
          // static injections first, followed by eager singletons.  Each of
          // these method calls performs all necessary initialization of the
          // given type in all fragments, ensuring that the initializers run in
View Full Code Here


    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"
View Full Code Here

        .convertToValidMemberName(
            "injectStatic_com.google.gwt.inject.rebind.output.subpackage."
            + "SubPackageClass"))
        .andStubReturn("test_injectSubPackageClass");

    SourceWriteUtil sourceWriteUtil = createMock(SourceWriteUtil.class, "sourceWriteUtil");
    expect(sourceWriteUtil.createFieldInjection(capture(fieldCapture), (String) anyObject(),
        (NameGenerator) anyObject(), (List<InjectorMethod>) anyObject()))
        .andReturn(SourceSnippets.forText(""));

    MethodCallUtil methodCallUtil = createMock(MethodCallUtil.class, "methodCallUtil");
    expect(methodCallUtil.createMethodCallWithInjection(capture(methodCapture),
View Full Code Here

TOP

Related Classes of com.google.gwt.inject.rebind.util.SourceWriteUtil

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.