@Override
  public void writeFieldReadStatement(
      VariableElement field,
      Collection<ExecutableElement> postCreateChildMethods,
      JavaWriter writer)
      throws IOException {
    DeclaredType type = (DeclaredType) field.asType();
    TypeMirror itemType = type.getTypeArguments().get(0);
    TypeMirror itemTypeErasure = processingEnv.getTypeUtils().erasure(itemType);

    String collectionInitializer;
    try {
      collectionInitializer = initializers.findCollectionInitializer(type);
    } catch (InvalidTypeException e) {
      processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, e.getMessage(), field);
      collectionInitializer = "null";
    }
    writer.beginControlFlow("if (bundle.containsKey(\"%s\"))", field.getSimpleName());
    writer.emitStatement("object.%s = %s", field.getSimpleName(), collectionInitializer);
    writer.emitStatement(
        "%1$s.readCollectionFromBundle(object.%2$s, bundle, %3$s.class, \"%2$s\")",
        CollectionBundler.class.getCanonicalName(), field.getSimpleName(), itemTypeErasure);

    writePostCreateChildMethodCalls(field, itemType, postCreateChildMethods, writer);
    writer.endControlFlow();
  }
  @Override
  public void writeFieldWriteStatement(VariableElement field, JavaWriter writer)
      throws IOException {
    DeclaredType type = (DeclaredType) field.asType();
    TypeMirror itemType = type.getTypeArguments().get(0);
    TypeMirror itemTypeErasure = processingEnv.getTypeUtils().erasure(itemType);

    writer.beginControlFlow("if (object.%s != null)", field.getSimpleName());
    writer.emitStatement(
        "%1$s.writeCollectionToBundle(object.%2$s, bundle, %3$s.class, \"%2$s\")",
        CollectionBundler.class.getCanonicalName(), field.getSimpleName(), itemTypeErasure);
    writer.endControlFlow();
  }
 public void generateFieldDeclaration(VariableElement fieldElement, Modifier... modifiers) {
   println(
       "  {0}{1} {2};",
       generateModifierList(modifiers),
       fieldElement.asType().toString(),
       fieldElement.getSimpleName());
 }
  private void emitSqlTableDeclaration(boolean view) throws IOException {
    writer.writeComment("--- " + (view ? "view" : "subquery") + " declaration");
    String name = "\"" + modelSpec.viewName() + "\"";
    if (queryElement != null) {
      Expression queryReference =
          Expressions.staticReference(sourceElementName, queryElement.getSimpleName().toString())
              .callMethod("selectMore", ALIASED_PROPERTY_ARRAY_NAME);
      if (viewQueryAnnotation.freeze()) {
        queryReference = queryReference.callMethod("freeze");
      }

      writer.writeFieldDeclaration(
          TypeConstants.QUERY, QUERY_NAME, queryReference, TypeConstants.PUBLIC_STATIC_FINAL);

      Expression initializer = constructInitializer(name, view);
      writer.writeFieldDeclaration(
          view ? TypeConstants.VIEW : TypeConstants.SUBQUERY_TABLE,
          view ? VIEW_NAME : SUBQUERY_NAME,
          initializer,
          TypeConstants.PUBLIC_STATIC_FINAL);
    } else {
      writer.writeFieldDeclaration(
          CoreTypes.JAVA_STRING,
          view ? "VIEW_NAME" : "SUBQUERY_NAME",
          Expressions.fromString(name),
          TypeConstants.PUBLIC_STATIC_FINAL);
    }
    writer.writeNewline();
  }
Exemple #5
0
 @Override
 public void printErrorCheckMethod(
     final PrintWriter writer, final ExecutableElement method, final String tabs) {
   final Check check = method.getAnnotation(Check.class);
   if (check != null) // Get the error code from an IntBuffer output parameter
   writer.println(
         tabs + "Util.checkCLError(" + check.value() + ".get(" + check.value() + ".position()));");
   else {
     final Class return_type = Utils.getJavaType(method.getReturnType());
     if (return_type == int.class) writer.println(tabs + "Util.checkCLError(__result);");
     else {
       boolean hasErrCodeParam = false;
       for (final VariableElement param : method.getParameters()) {
         if ("errcode_ret".equals(param.getSimpleName().toString())
             && Utils.getJavaType(param.asType()) == IntBuffer.class) {
           hasErrCodeParam = true;
           break;
         }
       }
       if (hasErrCodeParam)
         throw new RuntimeException(
             "A method is missing the @Check annotation: " + method.toString());
     }
   }
 }
  private void createConstructorAndBuilder() {
    List<ExecutableElement> constructors = new ArrayList<ExecutableElement>();
    for (Element e : annotatedElement.getEnclosedElements()) {
      if (e.getKind() == CONSTRUCTOR) {
        constructors.add((ExecutableElement) e);
      }
    }

    for (ExecutableElement userConstructor : constructors) {
      JMethod copyConstructor = generatedClass.constructor(PUBLIC);
      JMethod staticHelper =
          generatedClass.method(PUBLIC | STATIC, generatedClass._extends(), "build");

      codeModelHelper.generifyStaticHelper(this, staticHelper, getAnnotatedElement());

      JBlock body = copyConstructor.body();
      JInvocation superCall = body.invoke("super");
      JInvocation newInvocation = JExpr._new(generatedClass);
      for (VariableElement param : userConstructor.getParameters()) {
        String paramName = param.getSimpleName().toString();
        JClass paramType = codeModelHelper.typeMirrorToJClass(param.asType(), this);
        copyConstructor.param(paramType, paramName);
        staticHelper.param(paramType, paramName);
        superCall.arg(JExpr.ref(paramName));
        newInvocation.arg(JExpr.ref(paramName));
      }

      JVar newCall = staticHelper.body().decl(generatedClass, "instance", newInvocation);
      staticHelper.body().invoke(newCall, getOnFinishInflate());
      staticHelper.body()._return(newCall);
      body.invoke(getInit());
    }
  }
Exemple #7
0
  @Override
  public void process(Element element, EBeanHolder holder) {
    final ExecutableElement afterPutMethod = (ExecutableElement) element;
    final UseModelHolder useModelHolder = holder.getPluginHolder(new UseModelHolder(holder));
    useModelHolder.setAfterPutMethod(afterPutMethod);

    List<Class<? extends Annotation>> annotations =
        Arrays.asList(UseModel.class, LocalDBModel.class, ServerModel.class);
    for (Class<? extends Annotation> annotation : annotations) {
      if (element.getAnnotation(annotation) != null) return;
    }

    List<? extends VariableElement> parameters = afterPutMethod.getParameters();

    JInvocation invocation =
        useModelHolder
            .getPutModelInitBlock()
            ._if(ref("result").ne(_null()))
            ._then()
            .invoke(afterPutMethod.getSimpleName().toString());

    for (VariableElement param : parameters) {
      final String paramName = param.getSimpleName().toString();
      ParamUtils.injectParam(paramName, invocation);
    }
  }
Exemple #8
0
 public MapKeyNamingType getMapKeyNamingValue() {
   VariableElement enumConstant = AnnotationValueUtil.toEnumConstant(mapKeyNaming);
   if (enumConstant == null) {
     throw new AptIllegalStateException("mapKeyNaming");
   }
   return MapKeyNamingType.valueOf(enumConstant.getSimpleName().toString());
 }
  private ExecutableElement[] findGetterAndSetter(TypeElement cls, VariableElement variable) {
    ExecutableElement[] gs = new ExecutableElement[] {null, null};

    List<? extends Element> enclosedElements = cls.getEnclosedElements();
    String capitalizedVarName = StringUtils.startUpperCase(variable.getSimpleName().toString());
    String getterName = String.format("get%s", capitalizedVarName);
    String setterName = String.format("set%s", capitalizedVarName);

    for (int i = 0, c = enclosedElements.size(); i < c; i++) {
      Element e = enclosedElements.get(i);
      if (e.getKind() == ElementKind.METHOD) {
        if (getterName.equals(e.getSimpleName().toString())) {
          gs[0] = (ExecutableElement) e;
        } else if (setterName.equals(e.getSimpleName().toString())) {
          gs[1] = (ExecutableElement) e;
        } else {
          continue;
        }

        if (gs[0] != null && gs[1] != null) {
          break;
        }
      }
    }

    return gs;
  }
 private static void printParameterCaching(
     PrintWriter writer,
     TypeElement interface_decl,
     ExecutableElement method,
     Mode mode,
     boolean context_specific) {
   for (VariableElement param : method.getParameters()) {
     Class java_type = Utils.getJavaType(param.asType());
     CachedReference cachedReference = param.getAnnotation(CachedReference.class);
     if (Buffer.class.isAssignableFrom(java_type)
         && cachedReference != null
         && (mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null)
         && param.getAnnotation(Result.class) == null) {
       writer.print("\t\tif ( LWJGLUtil.CHECKS ) StateTracker.");
       if (context_specific) {
         writer.print("getReferences(caps).");
       } else {
         writer.print("getTracker().");
       }
       if (cachedReference.name().length() > 0) {
         writer.print(cachedReference.name());
       } else {
         writer.print(Utils.getReferenceName(interface_decl, method, param));
       }
       if (cachedReference.index().length() > 0) {
         writer.print("[" + cachedReference.index() + "]");
       }
       writer.println(" = " + param.getSimpleName() + ";");
     }
   }
 }
 @Override
 public Void visitEnumConstant(VariableElement c, JAnnotationArrayMember p) {
   JClass annotationClass = helper.typeMirrorToJClass(c.asType(), holder);
   JExpression expression = JExpr.direct(annotationClass.fullName() + "." + c.getSimpleName());
   p.param(expression);
   return null;
 }
 public void generateFieldDeclaration(VariableElement fieldElement) {
   println(
       "  {0}{1} {2};",
       generateModifierList(fieldElement.getModifiers().toArray(new Modifier[] {})),
       fieldElement.asType().toString(),
       fieldElement.getSimpleName());
 }
  private void addActionToIntentBuilder(
      EIntentServiceHolder holder,
      ExecutableElement executableElement,
      String methodName,
      JFieldVar actionKeyField) {
    JMethod method =
        holder.getIntentBuilderClass().method(PUBLIC, holder.getIntentBuilderClass(), methodName);
    JBlock body = method.body();

    // setAction
    body.invoke("action").arg(actionKeyField);

    // For each method params, we get put value into extras
    List<? extends VariableElement> methodParameters = executableElement.getParameters();
    if (methodParameters.size() > 0) {

      // Extras params
      for (VariableElement param : methodParameters) {
        String paramName = param.getSimpleName().toString();
        JClass parameterClass = codeModelHelper.typeMirrorToJClass(param.asType(), holder);

        JFieldVar paramVar = getStaticExtraField(holder, paramName);
        JVar methodParam = method.param(parameterClass, paramName);

        JMethod putExtraMethod =
            holder.getIntentBuilder().getPutExtraMethod(param.asType(), paramName, paramVar);
        body.invoke(putExtraMethod).arg(methodParam);
      }
    }
    body._return(JExpr._this());
  }
 private static boolean generateParameterJava(
     PrintWriter writer,
     VariableElement param,
     TypeInfo type_info,
     boolean native_stub,
     final boolean printTypes,
     boolean first_parameter,
     Mode mode) {
   Class buffer_type = Utils.getNIOBufferType(param.asType());
   if (!first_parameter) {
     writer.print(", ");
   }
   BufferObject bo_annotation = param.getAnnotation(BufferObject.class);
   if (bo_annotation != null && mode == Mode.BUFFEROBJECT) {
     if (buffer_type == null) {
       throw new RuntimeException(
           "type of "
               + param
               + " is not a nio Buffer parameter but is annotated as buffer object");
     }
     if (printTypes) {
       writer.print("long ");
     }
     writer.print(param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX);
   } else {
     if (native_stub && param.getAnnotation(PointerWrapper.class) != null) {
       writer.print("long ");
     } else {
       Class type = type_info.getType();
       if (native_stub
           && (type == CharSequence.class
               || type == CharSequence[].class
               || type == PointerBuffer.class
               || Buffer.class.isAssignableFrom(type))) {
         writer.print("long ");
       } else if (printTypes) {
         writer.print(type.getSimpleName() + " ");
       }
     }
     AutoSize auto_size_annotation = param.getAnnotation(AutoSize.class);
     if (auto_size_annotation != null) {
       writer.print(auto_size_annotation.value() + "_");
     }
     writer.print(param.getSimpleName());
   }
   return false;
 }
Exemple #15
0
 public boolean containsField(String name) {
   for (VariableElement field : getFields()) {
     if (field.getSimpleName().toString().equals(name)) {
       return true;
     }
   }
   return false;
 }
Exemple #16
0
  private void parseIdentifier(VariableElement fieldElement) {
    final String name = fieldElement.getSimpleName().toString();
    assert name.endsWith("_IDENTIFIER");

    final String propertyName =
        NameUtils.constantToIdentifier(name.substring(0, name.length() - "_IDENTIFIER".length()));

    getProperty(propertyName).setHasIdentifier(true);
  }
 public void generateConstantFieldDeclaration(VariableElement fieldElement) {
   if (isConstant(fieldElement)) {
     String constantValue = determineFinalConstantValue(fieldElement);
     if (constantValue != null) {
       println(
           "  {0}{1} {2} = {3};",
           generateModifierList(fieldElement.getModifiers().toArray(new Modifier[] {})),
           fieldElement.asType().toString(),
           fieldElement.getSimpleName(),
           constantValue);
     } else {
       println(
           "  {0}{1} {2};",
           generateModifierList(fieldElement.getModifiers().toArray(new Modifier[] {})),
           fieldElement.asType().toString(),
           fieldElement.getSimpleName());
     }
   }
 }
 protected String manufactureAccessorName(VariableElement fieldElement) {
   String name;
   if (fieldElement
       .asType()
       .toString()
       .equals(java.lang.Boolean.class.getSimpleName().toLowerCase())) {
     name = "is";
   } else {
     name = "get";
   }
   name += firstCharToUpperCase(fieldElement.getSimpleName().toString());
   return name;
 }
  protected Map<String, String> loadEnumValues() {
    List<VariableElement> enumConstants = getEnumConstants();
    Map<String, String> enumValueMap = new LinkedHashMap<String, String>();
    HashSet<String> enumValues = new HashSet<String>(enumConstants.size());
    for (VariableElement enumConstant : enumConstants) {
      String value = enumConstant.getSimpleName().toString();

      if (context.isHonorJaxb()) {
        XmlEnumValue enumValue = enumConstant.getAnnotation(XmlEnumValue.class);
        if (enumValue != null) {
          value = enumValue.value();
        }
      }

      if (!enumValues.add(value)) {
        throw new EnunciateException(getQualifiedName() + ": duplicate enum value: " + value);
      }

      enumValueMap.put(enumConstant.getSimpleName().toString(), value);
    }
    return enumValueMap;
  }
Exemple #20
0
 static Parameter forVariableElement(VariableElement variable) {
   ImmutableSet.Builder<String> qualifiers = ImmutableSet.builder();
   for (AnnotationMirror annotationMirror : variable.getAnnotationMirrors()) {
     DeclaredType annotationType = annotationMirror.getAnnotationType();
     if (annotationType.asElement().getAnnotation(Qualifier.class) != null) {
       qualifiers.add(Mirrors.getQualifiedName(annotationType).toString());
     }
   }
   return new Parameter(
       FluentIterable.from(qualifiers.build()).first(),
       variable.asType().toString(),
       variable.getSimpleName().toString());
 }
  private void addActionInOnHandleIntent(
      EIntentServiceHolder holder,
      ExecutableElement executableElement,
      String methodName,
      JFieldVar actionKeyField) {
    // If action match, call the method
    JInvocation actionCondition =
        actionKeyField.invoke("equals").arg(holder.getOnHandleIntentIntentAction());
    JBlock callActionBlock = holder.getOnHandleIntentBody()._if(actionCondition)._then();
    JInvocation callActionInvocation = JExpr._super().invoke(methodName);

    // For each method params, we get back value from extras and put it
    // in super calls
    List<? extends VariableElement> methodParameters = executableElement.getParameters();
    if (methodParameters.size() > 0) {
      // Extras
      JVar extras = callActionBlock.decl(classes().BUNDLE, "extras");
      extras.init(holder.getOnHandleIntentIntent().invoke("getExtras"));
      JBlock extrasNotNullBlock = callActionBlock._if(extras.ne(_null()))._then();

      // Extras params
      for (VariableElement param : methodParameters) {
        String paramName = param.getSimpleName().toString();
        String extraParamName = paramName + "Extra";
        JFieldVar paramVar = getStaticExtraField(holder, paramName);
        JClass extraParamClass = codeModelHelper.typeMirrorToJClass(param.asType(), holder);
        BundleHelper bundleHelper = new BundleHelper(annotationHelper, param);

        JExpression getExtraExpression =
            JExpr.invoke(extras, bundleHelper.getMethodNameToRestore()).arg(paramVar);
        if (bundleHelper.restoreCallNeedCastStatement()) {
          getExtraExpression = JExpr.cast(extraParamClass, getExtraExpression);

          if (bundleHelper.restoreCallNeedsSuppressWarning()) {
            JMethod onHandleIntentMethod = holder.getOnHandleIntentMethod();
            if (onHandleIntentMethod.annotations().size() == 0) {
              onHandleIntentMethod.annotate(SuppressWarnings.class).param("value", "unchecked");
            }
          }
        }

        JVar extraField =
            extrasNotNullBlock.decl(extraParamClass, extraParamName, getExtraExpression);
        callActionInvocation.arg(extraField);
      }
      extrasNotNullBlock.add(callActionInvocation);
    } else {
      callActionBlock.add(callActionInvocation);
    }
    callActionBlock._return();
  }
  private void writePostCreateChildMethodCalls(
      VariableElement field,
      TypeMirror itemType,
      Collection<ExecutableElement> postCreateChildMethods,
      JavaWriter writer)
      throws IOException {

    if (!postCreateChildMethods.isEmpty() && metaTypes.isSubtype(itemType, Names.PARCELABLE)) {
      writer.beginControlFlow("for (Object child : object.%s)", field.getSimpleName());
      for (ExecutableElement method : postCreateChildMethods) {
        writer.emitStatement("object.%s(child)", method.getSimpleName());
      }
      writer.endControlFlow();
    }
  }
 /**
  * Generates a list of Fields.
  *
  * <p><b>Usage:</b>
  *
  * <pre>
  * <code>generateFieldList(myList, true, false)</code></pre>
  *
  * <b>Generated example:</b>
  *
  * <pre>
  * <code>
  *  String myField1, int myField2, final String myField3
  * </code></pre>
  */
 public String generateFieldList(
     Collection<VariableElement> fieldElements, boolean withType, boolean leadingComma) {
   String fieldList = "";
   if (fieldElements != null && fieldElements.size() > 0) {
     int i = 0;
     for (VariableElement fieldElement : fieldElements) {
       if (leadingComma || i++ > 0) {
         fieldList += ", ";
       }
       if (withType) {
         fieldList += fieldElement.asType().toString();
         fieldList += " ";
       }
       fieldList += fieldElement.getSimpleName();
     }
   }
   return fieldList;
 }
  /**
   * Make a cal to this method
   *
   * @return String
   */
  protected String makeCall() {
    StringBuilder sb = new StringBuilder(methName);

    sb.append("(");

    boolean first = true;
    for (VariableElement par : pars) {
      if (!first) {
        sb.append(", ");
      }
      sb.append(par.getSimpleName());

      first = false;
    }
    sb.append(")");

    return sb.toString();
  }
Exemple #25
0
  private void parseShapeConstructor(ExecutableElement methodElement) {
    List<? extends VariableElement> parameters = methodElement.getParameters();

    if (superLayout != null) {
      assert parameters.size() >= superLayout.getAllShapeProperties().size();
      parameters =
          parameters.subList(superLayout.getAllShapeProperties().size(), parameters.size());
    }

    for (VariableElement element : parameters) {
      final String name = element.getSimpleName().toString();

      constructorProperties.add(name);
      final PropertyBuilder property = getProperty(name);
      setPropertyType(property, element.asType());
      parseConstructorParameterAnnotations(property, element);
      property.setIsShapeProperty(true);
      hasShapeProperties = true;
    }
  }
Exemple #26
0
  public List<Parameter> getParameters(ExecutableType methodType, ExecutableElement method) {
    List<? extends TypeMirror> parameterTypes = methodType.getParameterTypes();
    List<? extends VariableElement> parameters = method.getParameters();
    List<Parameter> result = new ArrayList<Parameter>(parameters.size());

    Iterator<? extends VariableElement> varIt = parameters.iterator();
    Iterator<? extends TypeMirror> typesIt = parameterTypes.iterator();

    for (; varIt.hasNext(); ) {
      VariableElement parameter = varIt.next();
      TypeMirror parameterType = typesIt.next();

      result.add(
          new Parameter(
              parameter.getSimpleName().toString(),
              getType(parameterType),
              MappingTargetPrism.getInstanceOn(parameter) != null,
              TargetTypePrism.getInstanceOn(parameter) != null));
    }

    return result;
  }
 private static VariableElement getAutoTypeParameter(
     ExecutableElement method, VariableElement target_parameter) {
   for (VariableElement param : method.getParameters()) {
     AnnotationMirror auto_annotation = Utils.getParameterAutoAnnotation(param);
     if (auto_annotation != null) {
       Class annotation_type =
           NativeTypeTranslator.getClassFromType(auto_annotation.getAnnotationType());
       String parameter_name;
       if (annotation_type.equals(AutoType.class)) {
         parameter_name = param.getAnnotation(AutoType.class).value();
       } else if (annotation_type.equals(AutoSize.class)) {
         parameter_name = param.getAnnotation(AutoSize.class).value();
       } else {
         throw new RuntimeException("Unknown annotation type " + annotation_type);
       }
       if (target_parameter.getSimpleName().toString().equals(parameter_name)) {
         return param;
       }
     }
   }
   return null;
 }
Exemple #28
0
  @Override
  public void process(Element element, EComponentWithViewSupportHolder holder) throws Exception {

    ActionScanner.processActions(element, holder);

    uniquePriorityCounter++;

    final ViewsHolder viewsHolder =
        holder.getPluginHolder(new ViewsHolder(holder, annotationHelper));
    final String methodName = element.getSimpleName().toString();

    JBlock block = new JBlock();
    JInvocation invoke = block.invoke(methodName);

    ExecutableElement exeElem = (ExecutableElement) element;
    for (VariableElement param : exeElem.getParameters()) {
      final String paramName = param.getSimpleName().toString();
      ParamUtils.injectParam(paramName, invoke, viewsHolder);
    }

    SharedRecords.priorityAdd(holder.getOnViewChangedBody(), block, uniquePriorityCounter);
  }
  private void processLabels(TypeElement resourcesType, List<LabelTemplateMethod> methods) {
    for (Element element : resourcesType.getEnclosedElements()) {
      if (element.getKind() != ElementKind.METHOD) {
        continue;
      }
      final ExecutableElement method = (ExecutableElement) element;
      Message labelAnnotation = element.getAnnotation(Message.class);
      final TemplateParam returnType = new TemplateParam(method.getReturnType().toString());
      final boolean deprecated = method.getAnnotation(Deprecated.class) != null;
      final LabelTemplateMethod labelMethod;
      try {
        labelMethod =
            new LabelTemplateMethod(
                method.getSimpleName().toString(),
                deprecated,
                returnType,
                labelAnnotation.value(),
                labelAnnotation.mobile());
      } catch (Throwable t) {
        processingEnv.getMessager().printMessage(Kind.WARNING, t.getMessage(), resourcesType);
        continue;
      }

      for (VariableElement variable : method.getParameters()) {
        final String paramName = variable.getSimpleName().toString();
        final String paramType = variable.asType().toString();

        List<TemplateAnnotation> annotations = new ArrayList<TemplateAnnotation>();
        for (AnnotationMirror annotationMirrors : variable.getAnnotationMirrors()) {
          annotations.add(new TemplateAnnotation(annotationMirrors.getAnnotationType().toString()));
        }

        labelMethod.getParams().add(new TemplateParam(paramType, paramName, annotations));
      }
      methods.add(labelMethod);
    }
  }
  public String brewJava() throws Exception {
    Map<String, String> parameterNameMap = new LinkedHashMap<>();
    StringBuilder sb = new StringBuilder(" public ");

    String returnTypeName = this.returnType.toString();

    sb.append(returnTypeName + " ");
    sb.append(methodName + "(");
    boolean isFirst = true;

    for (VariableElement variableElement : arguments) {
      DeclaredType type = (DeclaredType) variableElement.asType();
      String typeName = type.asElement().toString();
      String variableName = variableElement.getSimpleName().toString();

      String parameterName = variableName;

      parameterNameMap.put(parameterName, variableName);
      if (!isFirst) {
        sb.append(", ");
      }

      sb.append(typeName);
      sb.append(" " + variableName);

      if (isFirst) {
        isFirst = false;
      }
    }

    sb.append(") {\n");
    sb.append(buildFunctionBody(parameterNameMap));
    sb.append("}\n");

    return sb.toString();
  }