String (@NotNull Context context, @NotNull String optionalCall) { List<String> params = context.myMethodParams; StringBuilder signature = new StringBuilder("void foo("); if (!params.isEmpty()) signature.append("String ").append(String.join(", String ", params)); signature.append(")"); return signature.append("{\n").append(generateMethodBody(context, optionalCall)).append("\n}").toString(); }