Package rocket.generator.rebind.codeblock

Examples of rocket.generator.rebind.codeblock.CodeBlock


  protected CodeBlock getMethodParameterTypes() {
    final List<MethodParameter> parameters = this.getMethod().getParameters();

    // this code block creates a String array holding the parameter type
    // names.
    return new CodeBlock() {
      public boolean isEmpty() {
        return false;
      }

      public void write(final SourceWriter writer) {
View Full Code Here


   * @param writer
   */
  public void writeBody(final SourceWriter writer) {
    Checker.notNull("parameter:writer", writer);

    final CodeBlock body = this.getBody();
    if (false == body.isEmpty()) {
      body.write(writer);
    }
  }
View Full Code Here

    final Constructor constructor = type.getConstructor(Collections.EMPTY_LIST);
    final NewInstanceTemplatedFile newInstanceStatement = new NewInstanceTemplatedFile();
    newInstanceStatement.setConstructor(constructor);

    final CodeBlock returnStatement = new CodeBlock() {
      public boolean isEmpty() {
        return false;
      }

      public void write(final SourceWriter writer) {
View Full Code Here

   * @param writer
   */
  public void writeBody(final SourceWriter writer) {
    Checker.notNull("parameter:writer", writer);

    final CodeBlock body = this.getBody();
    if (false == body.isEmpty()) {
      writer.indent();
      body.write(writer);
      writer.outdent();
    }
  }
View Full Code Here

  }

  protected void writeValue(final SourceWriter writer) {
    Checker.notNull("parameter:writer", writer);

    final CodeBlock codeBlock = this.getValue();
    if (codeBlock.isEmpty()) {
      writer.println(";");
    } else {
      writer.print("=");
      codeBlock.write(writer);

      // terminate any literal with a semi colon.
      if (codeBlock instanceof Literal) {
        writer.println(";");
      }
View Full Code Here

  }

  public void write(final SourceWriter writer) {
    Checker.notNull("parameter:writer", writer);

    CodeBlock literal = null;

    while (true) {
      final Type type = this.getPropertyType();
      final GeneratorContext context = this.getGeneratorContext();
      if (type == context.getBoolean()) {
        literal = new BooleanLiteral(this.getBooleanValue());
        break;
      }
      if (type == context.getByte()) {
        literal = new ByteLiteral(this.getByteValue());
        break;
      }
      if (type == context.getShort()) {
        literal = new ShortLiteral(this.getShortValue());
        break;
      }
      if (type == context.getInt()) {
        literal = new IntLiteral(this.getIntValue());
        break;
      }
      if (type == context.getLong()) {
        literal = new LongLiteral(this.getLongValue());
        break;
      }
      if (type == context.getFloat()) {
        literal = new FloatLiteral(this.getFloatValue());
        break;
      }
      if (type == context.getDouble()) {
        literal = new DoubleLiteral(this.getDoubleValue());
        break;
      }
      if (type == context.getChar()) {
        literal = new CharLiteral(this.getCharValue());
        break;
      }

      // will default to String for List/Set/Map which wont have set the
      // propertyType of any StringValues
      literal = new StringLiteral(this.getValue());
      break;
    }

    literal.write(writer);
  }
View Full Code Here

    final Method method = newType.findMostDerivedMethod(methodName, Collections.<Type>emptyList());
    final NewMethod newMethod = method.copy(newType);
    newMethod.setAbstract(false);
    newMethod.setFinal(true);

    final CodeBlock commaSeparatedList = new CodeBlock() {
      public boolean isEmpty() {
        return false;
      }

      public void write(final SourceWriter writer) {
View Full Code Here

    final NewMethod newMethod = method.copy(newType);
    newMethod.setAbstract(false);
    newMethod.setFinal(true);
    newMethod.setNative(false);

    CodeBlock body = null;
    while (true) {
      final Type widgetType = method.getReturnType();

      if (widgetType.equals(this.getTextBox())) {
        body = buildTextBoxGetterMethodBody(method);
View Full Code Here

   * @return The codeblock
   */
  protected CodeBlock buildHtmlGetterMethodBody(final Method method) {
    Checker.notNull("parameter:method", method);

    CodeBlock body = null;

    // need to test if Html is coming from id or file.
    while (true) {
      String file = null;
      String id = null;
View Full Code Here

TOP

Related Classes of rocket.generator.rebind.codeblock.CodeBlock

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.