I am developing a small compiler like tool. In the process, I wrote a Class<?> wrapper, JavaClass:public class JavaClass {    ...    public List<GenericEntry> getAllGenericEntries() {        return GenericEntriesFinder.getAllGenericEntries(this);    }}I've at first written the bellow shown code inside JavaClass, but I soon found it too big to mantain in JavaClass, that is already getting fat. I basically will only want to ever use getAllGenericEntries(), so all the other methods are basically implementation details.public class GenericEntriesFinder {    public static List<GenericEntry> getAllGenericEntries(JavaClass javaClass) {        List<GenericEntry> result = new ArrayList<GenericEntry>();        result.addAll(getClassGenericEntries(javaClass));        result.addAll(getInterfaceGenericEntries(javaClass));        return result;    }    private static List<GenericEntry> getClassGenericEntries(JavaClass javaClass) {        IJavaType genericSuperClass = javaClass.getGenericSuperclass();        JavaClass superClass = javaClass.getSuperClass();        return getGenericEntries(javaClass, Arrays.asList(genericSuperClass), Arrays.asList(superClass));    }    private static List<GenericEntry> getInterfaceGenericEntries(JavaClass javaClass) {        List<IJavaType> genericInterfaces = javaClass.getGenericInterfaces();        List<JavaClass> nonGenericInterfaces = javaClass.getInterfaces();        return getGenericEntries(javaClass, genericInterfaces, nonGenericInterfaces);    }    private static List<GenericEntry> getGenericEntries(JavaClass javaClass, List<IJavaType> generic, List<JavaClass> nonGeneric) {        List<GenericEntry> result = new ArrayList<GenericEntry>();        for (int i = 0; i < generic.size(); ++i) {            IJavaType javaType = generic.get(i);            JavaClass className = nonGeneric.get(i);            if (javaType.isParameterizedType()) {                List<JavaTypeVariable> typeVariables = className.getTypeParameters();                for (int y = 0; y < typeVariables.size(); ++y) {                    ParameterizedType parameterizedType = javaType.getAsParameterizedType();                    IJavaType parameter = JavaFactory.createJavaType(parameterizedType.getActualTypeArguments()[y]);                    result.add(new GenericEntry(typeVariables.get(y), parameter));                }            }        }        return result;    }}My question is in how to organize this. I see several alternatives:I could put everything in JavaClass (doesn't seem that great of an idea).I could put getAllGenericEntries() in JavaClass, that delegates all the work to GenericEntriesFinder.getAllGenericEntries(). This seems to be nice as the client of JavaClass can use the method as long as he has a JavaClass in his hand.I could put all this logic in a separate class(GenericEntriesFinder, for instance). If I ever wanted to use this logic, I'd use GenericEntriesFinder and pass to getAllGenericEntries() a JavaClass instance. The client has the burden to know there actually exists an GenericEntriesFinder class, which is not that big of an issue, as I'm the only programmer, but still..If I am not mistaken these are the 3 main possibilities. For possibilities 2 and 3 there is still the question of whether to consider GenericEntriesFinder's methods as static or instance methods. I know in a pure OO scenario one should look and strive for using instance methods, but as I've come to find, when writing a compiler everything tends to turn into a heap of functions(that is, as a sequence of transformations of data), and it's hard a lot of the time to try to model this in a OO way (data plus operations on data).Plus, on 2., would I decide on using instance methods on GenericEntriesFinder, should I pass its instance in JavaClass's constructor? I don't particularly like this option, as if I start adding more and more methods to JavaClass, I will eventually have to pass it several classes like GenericEntriesFinder as constructor arguments. Passing classes by constructor argument may seem like a unit-testing plus but it actually will make gain nothing, as I'll be unit-testing GenericEntriesFinder.A big point in here is that this logic is going to be unit-tested.
Question on where to put code logic
java;unit testing