JavaMethod[] (String[] path, Class<? extends DomElement> startClass) { final JavaMethod[] methods = new JavaMethod[path.length]; Class<?> aClass = startClass; for (int i = 0; i < path.length; i++) { JavaMethod getter = findGetter(aClass, path[i]); assert getter != null : "Couldn't find getter for property " + path[i] + " in class " + aClass; methods[i] = getter; aClass = getter.getReturnType(); if (List.class.isAssignableFrom(aClass)) { @NotNull Type type = Objects.requireNonNull(extractCollectionElementType(getter.getGenericReturnType())); aClass = ClassUtil.getRawType(type); } } return methods; }