Just for the sake of completion, this is the final bit of code I’ll add to my original Wallpaper class:
Contents c = null;
final Class<?> appCls = getClass(), innerCls;
try {
innerCls = Class.forName(appCls.getName() + '$' + "AbstractExp"); // or whatever child class it is
c = (Contents) innerCls.getDeclaredConstructor(appCls, String.class).newInstance(this, "Booyah");
}
catch (final ClassNotFoundException ex) {
throw new RuntimeException(ex);
}
catch (final ReflectiveOperationException ex) {
System.err.println(ex);
}
c.printPattern();