package com.kiselev.reflection.ui.field;

import com.kiselev.reflection.ui.annotation.AnnotationsUtils;
import com.kiselev.reflection.ui.indent.IndentUtils;
import com.kiselev.reflection.ui.modifier.ModifiersUtils;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

public class FieldUtils {

    public String getFields(Class<?> clazz) {
        String fields = "";

        List<String> fieldList = new ArrayList<String>();
        for (Field field : clazz.getDeclaredFields()) {
            fieldList.add(getField(field));
        }
        if (!fieldList.isEmpty()) {
            fields += String.join("\n\n", fieldList) + "\n";
        }

        return fields;
    }

    private String getField(Field field) {
        String fieldSignature = "";

        String annotations = new AnnotationsUtils().getAnnotations(field);

        String indent = new IndentUtils().getIndent(field);

        String modifiers = new ModifiersUtils().getModifiers(field.getModifiers());

        String fieldName = field.getName();

        fieldSignature += annotations + indent + modifiers + fieldName + ";";

        return fieldSignature;
    }
}

@@ -92,32 +92,89 @@
 otationsUtils;%0D%0A
+import com.kiselev.reflection.ui.generic.GenericsUtils;%0D%0A
 import com.kisel
@@ -1091,24 +1091,106 @@
 iers());%0D%0A%0D%0A
+        String type = new GenericsUtils().resolveType(field.getGenericType());%0D%0A%0D%0A
         Stri
@@ -1284,16 +1284,29 @@
 ifiers +
+ type + %22 %22 +
  fieldNa

Add generic type to fields