Closed Horsmann closed 6 years ago
@reckart Is there a way to ask a class object for the number of its anonymous classes? At the moment I would try to brute force and simply test if a java class with a $[0-9]+
exists or not in the range of 1 to 100 or so. I get the inner classes by calling getDeclaredClasses()
but I haven't figured out how to find the number of anonymous classes?
You could use a Spring PathMatchingResourcePatternResolver to do a search based on the classname + a wildcard.
Well... isn't the number just the position of the class in the array returned by getDeclaredClasses()?
getDeclaredClasses() returns the inner
classes that are explicitly defined. Anonymous (inner) classes a la
Collections.sort(somelist, new Comparator() {...})
are not covered. I will give PathMatchingResourcePatternResolver a try, thx.
When storing classes during model serialization, the
$1
class file withinner classes
is not considered if its there. Features using inner classes thus break.