Examples of BoostedStringBuilder


Examples of net.sf.gluebooster.java.booster.essentials.objects.BoostedStringBuilder

   *            the parts of the comment. Null values are ignored.
   * @deprecated
   */
  public void appendJavadocComment(StringBuilder resultingSourcecode,
      Object... commentBodyParts) throws IOException {
    BoostedStringBuilder resultSourcecode = new BoostedStringBuilder(
        resultingSourcecode);
    resultSourcecode.append("\n");
    resultSourcecode.append("/**\n");
    for (Object commentBody : commentBodyParts) {
      if (commentBody != null) {
        BufferedReader reader = new BufferedReader(new StringReader(
            commentBody.toString()));
        String line = reader.readLine();
        while (line != null) {
          resultSourcecode.addLn(" * ", line);
          line = reader.readLine();
        }
      }
    }

    resultSourcecode.addLn(" */");

  }
 
View Full Code Here

Examples of net.sf.gluebooster.java.booster.essentials.objects.BoostedStringBuilder

  public JavaFeatureDescription appendConstant(
      StringBuilder resultingSourcecode,
      String rawConstantName,
      String value, String comment, Class constantClass) throws Exception {

    BoostedStringBuilder sourcecode = new BoostedStringBuilder(
        resultingSourcecode);
    JavaFeatureDescription result = new JavaFeatureDescription();
    result.setDescription(comment, "Value is ", value);
    result.setPublic().setStatic().setFinal();
    result.setReturnClass(constantClass.getName());
    result.setRawName(rawConstantName);
    result.setName(getConstantName(rawConstantName));
    result.setValue(value);

    appendJavadocComment(sourcecode, result);
    sourcecode.add(" public static final ", constantClass.getSimpleName(), " ");
    sourcecode.append(result.getName()).append(" = ");
    appendConstantValue(resultingSourcecode, value, constantClass);
    sourcecode.append(";\n\n");

    return result;
  }
View Full Code Here

Examples of net.sf.gluebooster.java.booster.essentials.objects.BoostedStringBuilder

   * @param packagename
   *            the name of the package
   * @deprecated
   */
  public void appendPackage(StringBuilder resultSourcecode, String packagename) {
    new BoostedStringBuilder(resultSourcecode).addLn("\npackage ",
        packagename, ";");
  }
View Full Code Here

Examples of net.sf.gluebooster.java.booster.essentials.objects.BoostedStringBuilder

      String propertyName, String propertyClass, boolean initialize,
      String comment, boolean isInterface) {
    if (comment == null)
      comment = "";

    BoostedStringBuilder result = new BoostedStringBuilder(
        resultingSourcecode);

    if (!isInterface) {
      // add field

      result.append("\n");
      result.append("/**\n");
      result.append(" *").append(comment).append("\n");
      result.append(" */\n");
      result.add("private ", propertyClass, " ", propertyName);
      if (initialize) {
        result.append(" = new ").append(propertyClass).append("()");
      }
      result.append(";\n");
      result.append("\n");
    }

    String parametername = "newValue";

    // Setter-Method
    result.append("/**\n");
    appendJavadocCommentOfSetter(resultingSourcecode, propertyName,
        comment,
        parametername, " * ");
    result.append("\n */\n");
    String nameUpper = propertyName.substring(0,1).toUpperCase() + propertyName.substring(1);
    result.add("public void set", nameUpper, "(", propertyClass, " ",
        parametername, ")");
    if (isInterface) {
      result.addLn(";");
    } else {

      result.addLn("{");
      result.addLn("   ", propertyName, " = newValue;");
      result.addLn("}");
    }
    result.addLn("\n");

    // Getter-Method
    String prefix = "get";
    if ("boolean".equals(propertyClass))
      prefix = "is";
    result.append("/**\n");
    appendJavadocCommentOfGetter(resultingSourcecode, propertyName,
        comment,
        " * ");
    result.append(" */\n");
    result.add("public ", propertyClass, " ", prefix, nameUpper, "()");
    if (isInterface) {
      result.addLn(";");
    } else {
      result.addLn("{");
      result.addLn("   return ", propertyName, ";");
      result.addLn("}");
    }
    result.addLn("\n");
  }
View Full Code Here

Examples of net.sf.gluebooster.java.booster.essentials.objects.BoostedStringBuilder

   *            details about the property
   */
  public void appendJavadocCommentOfGetter(StringBuilder resultingSourcecode,
      String propertyName, String propertyInformation, String linePrefix) {

    BoostedStringBuilder result = new BoostedStringBuilder(
        resultingSourcecode);
    result.addIfNotNull(linePrefix, "Getter of the property ");
    result.addLn(propertyName, ".<br/>");
    result.addLnIfNotNull(linePrefix, propertyInformation, " <br/>");
    result.addLnIfNotNull(linePrefix, "@return The value of the property",
        " <br/>");
  }
View Full Code Here

Examples of net.sf.gluebooster.java.booster.essentials.objects.BoostedStringBuilder

   *            the name of the parameter
   */
  public void appendJavadocCommentOfSetter(StringBuilder resultingSourcecode,
      String propertyName, String propertyInformation,
      String parametername, String linePrefix) {
    BoostedStringBuilder result = new BoostedStringBuilder(
        resultingSourcecode);
    result.setNewLinePrefix(linePrefix);
    result.add("Setter of the property ");
    result.addLn(propertyName, ".<br/>");
    result.addLn(propertyInformation, " <br/>");
    result.addLn("@return The value of the property", " <br/>");
    result.add("@param ", parametername, " The new value of the property");
  }
View Full Code Here

Examples of net.sf.gluebooster.java.booster.essentials.objects.BoostedStringBuilder

   * @return the modified sourcecode.
   */
  private String processCommands(String sourcecode) throws Exception
   {
    Text text = new Text(sourcecode, COMMAND_LINE_PREFIXES, CONTINUE);
    BoostedStringBuilder result = new BoostedStringBuilder(
        new StringBuilder());

    while (text.nextSection()) {
      result.addLn(text.getTextOfSection());
      Command command = text.getCommandOfSection();
      if (command != null)
        processCommand(command, result);
    }
     
      return result.toString();
     
   }
View Full Code Here

Examples of net.sf.gluebooster.java.booster.essentials.objects.BoostedStringBuilder

    String comment = separation[2];
    String getterPrefix = " get";
    if ("boolean".equals(propertytype))
      getterPrefix = " is";
     
    BoostedStringBuilder result = new BoostedStringBuilder(
        resultCode.getBuilder());
    result.setNewLinePrefix(indentation);
    result.addLn("/**");
    result.addLn(" * ", comment);
    result.addLn(" * The value of the property '", propertyname, "'");
    result.addLn(" */");
    result.addLn("private ", propertytype, " ", propertyname, ";");
    result.addLn();
    result.addLn("/**");
    result.addLn(" * The getter of the property '", propertyname, "'.");
    result.addLn(" * ", comment);
    result.addLn(" * @return the value of the property.");
    result.addLn(" */");
    result.addLn("public ", propertytype, getterPrefix,
        propertyNameUpperCase, "()");
    result.addLn("{");
    result.addLn("  return ", propertyname, ";");
    result.addLn("}");
    result.addLn();
    result.addLn("/**");
    result.addLn(" * The setter of the property '", propertyname, "'.");
    result.addLn(" * ", comment);
    result.addLn(" * @param newValue the new value of the property");
    result.addLn(" */");
    result.addLn("public void", " set", propertyNameUpperCase, "(",
        propertytype, " newValue)");
    result.addLn("{");
    result.addLn("   ", propertyname, " = newValue;");
    result.addLn("}");
    result.addLn();
     

   }
View Full Code Here

Examples of net.sf.gluebooster.java.booster.essentials.objects.BoostedStringBuilder

      String descriptionForDocumentation, StringBuilder resultSourcecode,
      String packagename, String classname) throws Exception {
   
    JavaFeatureDescription classDescription = JavaFeatureDescription.createClassDescription(packagename, classname, "Constants created from "
        + descriptionForDocumentation + ".", null);
    generateClassHeader(classDescription, new BoostedStringBuilder(
        resultSourcecode));
//    generateClassHeader(packagename, classname, "Constants created from "
//        + descriptionForDocumentation + ".", resultSourcecode, false);
    startBraces(resultSourcecode);
    appendConstantsFromKeys(resultSourcecode, properties,
View Full Code Here

Examples of net.sf.gluebooster.java.booster.essentials.objects.BoostedStringBuilder

    }

    valuesSourcecode.addLn(valuesBody);

    // actionPerformed for ControllerDelegate
    BoostedStringBuilder actionPerformedMethod = new BoostedStringBuilder(
        new StringBuilder());
    actionPerformedMethod.addLn("@Override");
    actionPerformedMethod
        .addLn("public void actionPerformed(java.awt.event.ActionEvent event) {");
    actionPerformedMethod.addLn("   try {");
    actionPerformedMethod
        .addLn("String command = event.getActionCommand();");
    actionPerformedMethod.addLn("if (command == null ){");
    actionPerformedMethod
        .addLn("  throw new NullPointerException(\"command must not be null\");");
    actionPerformedMethod.addLn("}");


    String delegateName = "delegate";

    controllerDelegateSourcecode.add("private  ",
        controllerSourcecode.getName(), " ", delegateName, ";\n");
    controllerDelegateSourcecode.add("public ",
        controllerDelegateSourcecode.getName(), " (",
        controllerSourcecode.getName(), " ",
        delegateName, " ){\n");
    controllerDelegateSourcecode.add("this.", delegateName, "= ",
        delegateName, ";\n");
    controllerDelegateSourcecode.add("}\n");

    for (ObjectDescription action : appDescription.getActions()) {
      String name = action.getName();
      String description = action.getDescription();

      Check.notNull(name, "action.getName()");
      // define the constant
      JavaFeatureDescription constantDescription = appendConstant(constantsSourcecode.getBuilder(), "Action " + name,
          action.getName(), description, String.class);

      // define the abstract method
      JavaFeatureDescription methodDesc = JavaFeatureDescription
          .createVoidInterfaceMethod(name, description);
      appendMethod(controllerSourcecode, methodDesc);

      String methodname = methodDesc.getName();

      // implement the delegate method
      methodDesc.setDelegateName(delegateName);
      methodDesc.setInterface(false);
      appendMethod(controllerDelegateSourcecode, methodDesc);

      actionPerformedMethod.addLn(" else if (",
          constantsSourcecode.getName(), ".",
          constantDescription.getName(), ".equals(command)){");
      actionPerformedMethod.addLn("  ", methodname, "();");
      actionPerformedMethod.addLn("}");

    }

    for (ObjectDescription value : appDescription.getValues()) {
      appendConstant(constantsSourcecode.getBuilder(),
          "Value " + value.getName(),
          value.getName(), value.getDescription(), String.class);
    }


    actionPerformedMethod.addLn("      else {");
    actionPerformedMethod
        .addLn("         throw new IllegalStateException(\"command \" + command + \" not supported\");");
    actionPerformedMethod.addLn("      }");

    actionPerformedMethod.addLn("   } catch (Exception exception){");
    actionPerformedMethod
        .addLn("      throw net.sf.gluebooster.java.booster.essentials.utils.ThrowableBoostUtils.toRuntimeException(exception);");
    actionPerformedMethod.addLn("   } ");

    endBraces(actionPerformedMethod.getBuilder());
    controllerDelegateSourcecode.add(actionPerformedMethod.getBuilder());

    for (BoostedStringBuilder<String, JavaFeatureDescription> builder : result) {
      endBraces(builder.getBuilder());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.