<commit_before>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;<commit_msg>Add generic type to fields<commit_after>package com.kiselev.reflection.ui.field;

import com.kiselev.reflection.ui.annotation.AnnotationsUtils;
import com.kiselev.reflection.ui.generic.GenericsUtils;
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 type = new GenericsUtils().resolveType(field.getGenericType());

        String fieldName = field.getName();

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

        return fieldSignature;
{'fraction_non_alphanumeric': 0.11871069182389937, 'fraction_numerical': 0.0, 'mean_word_length': 3.124797406807131, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7390355', 'n_tokens_mistral': 719, 'n_tokens_neox': 694, 'n_words': 146}