I have an Enum called Plugins:
public enum Plugins {
ROTATING_LINE (plugin.rotatingline.RotatingLine.class),
SNOW_SYSTEM (plugin.snow.SnowSystem.class);
private Class<?> c;
private Plugins (Class<?> c) {
this.c = c;
}
public Class<?> getClassObject() {
return c;
}
}
What I would like to do is to loop through all the enums in Plugins
and create new objects from those using the variable c
like this:
for (Plugins plugins : Plugins.values()) {
Class<?> c = plugins.getClassObject();
pluginList.add(new c(400, 400));
}
Is there a way of accomplishing this with a similar method? The reason why I want to do this is to create a list of classes that should be added to the List plugins when I start my application.