↧
Java instaniate an abstract class… sort of…
At work I had to create some test data for a junit test. The function I’m testing expects a super abstract class to be passed in and I need to test the same function for bunch of child classes. I wish...
View ArticleJava Generics – conditionally instantiate a class
From Class to list of Enums public static <T extends Enum> List<T> getList(Class<T> clazz) { return Arrays.asList(clazz.getEnumConstants()); } So if I want to instantiate a class via...
View Article