Style XML

Let me see if I can come up with something and then I will get back to you.

1 Like

I really wish I could just copy and paste code from my game framework because I have this really awesome code available but it depends on the Reflections library…

[java] public static <T> Iterator<Class<? extends T>> getClasses(Class<T> subClass)
{
Reflections reflect = new Reflections(new ConfigurationBuilder()
.setScanners(new SubTypesScanner(false /* don’t exclude Object.class */), new ResourcesScanner())
.setUrls(ClasspathHelper.forClassLoader(ClasspathHelper.contextClassLoader(), ClasspathHelper.staticClassLoader())));

Set&lt;Class&lt;? extends T&gt;&gt; classes = reflect.getSubTypesOf(subClass);
return classes.iterator();
}

public static Iterator&lt;Class&lt;?&gt;&gt; getClasses(String pkg)
{
Reflections reflect = new Reflections(new ConfigurationBuilder()
	.setScanners(new SubTypesScanner(false /* don't exclude Object.class */), new ResourcesScanner())
	.setUrls(ClasspathHelper.forClassLoader(ClasspathHelper.contextClassLoader(), ClasspathHelper.staticClassLoader()))
	.filterInputsBy(new FilterBuilder().include(FilterBuilder.prefix(pkg))));

Set&lt;Class&lt;?&gt;&gt; classes = reflect.getSubTypesOf(Object.class);
return classes.iterator();
}[/java]  With the #getClasses(Class) method we could easily search the entire class heiarchy for specific classes that extend "Element" and retrieve them to add to the LayoutParser.