package com.kiselev.reflection.ui.method;

import com.kiselev.reflection.ui.annotation.AnnotationsUtils;
import com.kiselev.reflection.ui.argument.ArgumentUtils;
import com.kiselev.reflection.ui.exception.ExceptionUtils;
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.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;

public class MethodUtils {

    public String getMethods(Class<?> clazz) {
        String methods = "";

        List<String> methodList = new ArrayList<>();
        for (Method method : clazz.getDeclaredMethods()) {
            methodList.add(getMethod(method));
        }

        if (!methodList.isEmpty()) {
            methods += String.join("\n\n", methodList) + "\n";
        }

        return methods;
    }

    private boolean isRealization(Method method) {
        return !(Modifier.isAbstract(method.getModifiers()) || Modifier.isNative(method.getModifiers()));
    }

    private String getMethod(Method method, boolean isImplementation) {
        String methodSignature = "";

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

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

        String isDefault = method.isDefault() ? "default " : "";

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

        String generics = new GenericsUtils().getGenerics(method);

        String returnType = new GenericsUtils().resolveType(method.getGenericReturnType());

        String methodName = method.getName();

        String arguments = new ArgumentUtils().getArguments(method);

        String exceptions = new ExceptionUtils().getExceptions(method);

        String body = isMethodRealization(method) ? " {\n" + indent + "}" : ";";

        methodSignature += annotations + indent + modifiers + generics + returnType + " " + methodName + arguments + exceptions + body;

        return methodSignature;
    }

    private boolean isMethodRealization(Method method) {
        return !Modifier.isAbstract(method.getModifiers()) && !Modifier.isNative(method.getModifiers());
    }
}

@@ -954,176 +954,8 @@
 %0D%0A%0D%0A
-    private boolean isRealization(Method method) %7B%0D%0A        return !(Modifier.isAbstract(method.getModifiers()) %7C%7C Modifier.isNative(method.getModifiers()));%0D%0A    %7D%0D%0A%0D%0A
     
@@ -996,34 +996,8 @@
 thod
-, boolean isImplementation
 ) %7B%0D
@@ -1830,16 +1830,28 @@
 indent +
+ isDefault +
  modifie

Add checking of method is default