String (String currentPrefix, String className) { if (!currentPrefix.startsWith(className)) return null; for (String infix : new String[]{".", "#", "::"}) { if (currentPrefix.startsWith(infix, className.length())) { return infix; } } return null; }