package com.kiselev.reflection.ui.argument;

import com.kiselev.reflection.ui.annotation.AnnotationUtils;
import com.kiselev.reflection.ui.generic.GenericsUtils;

import java.lang.reflect.Executable;
import java.lang.reflect.Parameter;
import java.util.ArrayList;

public class ArgumentUtils {

    public String getArguments(Executable executable) {
        String arguments = "";

        ArrayList<String> strings = new ArrayList<>();

        for (Parameter parameter : executable.getParameters()) {
            strings.add(getArgument(parameter));
        }

        arguments += "(" + String.join(", ", strings) + ")";

        return arguments;
    }

    private String getArgument(Parameter parameter) {
        String argumentSignature = "";

        String annotation = new AnnotationUtils().getAnnotations(parameter);

        String genericType = new GenericsUtils().resolveType(parameter.getParameterizedType());

        String parameterName = parameter.getName(); // TODO : -parameters check

        argumentSignature += annotation + genericType + " " + parameterName;

        return argumentSignature;
    }
}

@@ -949,24 +949,117 @@
 Type());%0D%0A%0D%0A
+        genericType = parameter.isVarArgs() ? convertToVarArg(genericType) : genericType;%0D%0A%0D%0A
         Stri
@@ -1250,12 +1250,134 @@
 %0D%0A    %7D%0D
+%0A%0D%0A    private String convertToVarArg(String type) %7B%0D%0A        return type.substring(0, type.length() - 2) + %22...%22;%0D%0A    %7D%0D
 %0A%7D%0D%0A

Add display varargs