samedi 3 janvier 2015

JAVA creating instance of nested static class with reflection

I want to create an instance of nested static class with reflection. I have the following code:



if (Modifier.isStatic(nestedClass.getModifiers())) {
//TODO - WRITE HERE SOMETHING
} else {
ctor = nestedClass.getDeclaredConstructor(outerClass);
ctor.setAccessible(true);
testInstance = ctor.newInstance(outerInstance);
}


but cant figure out what to do within the if statement. Some help or advice would be appreciated. Thanks.






Aucun commentaire:

Enregistrer un commentaire