public void writeConstructor()

in maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java [552:643]


  public void writeConstructor(
      PrettyWriter out,
      ComponentBean component,
      String overrideClassName,
      int modifiers) throws IOException
  {    
    String className;
        
    if (overrideClassName != null)
    {
      className  = overrideClassName;
    }
    else
    {
      String fullClassName = component.getComponentClass();
      className            = Util.getClassFromFullClass(fullClassName);
    }
    
    int classModifiers = component.getComponentClassModifiers();
    boolean isAbstract = Modifier.isAbstract(classModifiers);
    boolean isPackagePrivate = (modifiers & 
                                (Modifier.PRIVATE |  Modifier.PROTECTED | Modifier.PUBLIC)) == 0;
    
    if (Modifier.isProtected(modifiers))
    {
      out.println();
      out.println("/**");
      // TODO: restore this more descriptive comment with param docs
      //out.println(" * Construct an instance of the " + className);
      //out.println(" * with the specified renderer type.");
      //out.println(" * ");
      //out.println(" * @param rendererType  the renderer type");
      out.println(" * Construct an instance of the " + className + ".");
      out.println(" */");
      out.println("protected " + className + "(");
      out.indent();
      out.println("String rendererType");
      out.println(")");
      out.unindent();
      out.println("{");
      out.indent();

      writeConstructorContent(out, component, modifiers, "rendererType");

      out.unindent();
      out.println("}");

      // TODO: eliminate this inconsistency
      if (isAbstract)
      {
        out.println();
        out.println("/**");
        // TODO: restore this correctly phrased comment (tense vs. command)
        //out.println(" * Constructs an instance of " + className + ".");
        out.println(" * Construct an instance of the " + className + ".");
        out.println(" */");
        out.println("protected " + className + "()");
        out.println("{");
        out.indent();
        out.println("this(null);");
        out.unindent();
        out.println("}");
      }
    }
    else if ((Modifier.isPublic(modifiers) && !isAbstract) || isPackagePrivate)
    {
      String accessControl = Modifier.isPublic(modifiers)
        ? (isAbstract) ? "protected " : "public "
        : ""; // package private
      
      String rendererType = component.getRendererType();

      if (rendererType != null)
        rendererType = convertStringToBoxedLiteral("String", rendererType);

      out.println();
      out.println("/**");
      // TODO: restore this correctly phrased comment (tense vs. command)
      //out.println(" * Constructs an instance of " + className + ".");
      out.println(" * Construct an instance of the " + className + ".");
      out.println(" */");
            
      out.println(accessControl + className + "()");
      out.println("{");
      out.indent();

      writeConstructorContent(out, component, modifiers, rendererType);

      out.unindent();
      out.println("}");
    }
  }