Okay, here's the setup:
EnclosingClass {
public interface ClassFactory {
public static SomeClass getInstance(int which);
}
private static ClassFactoryImpl {
@Override
public static SomeClass getInstance(int which) {
switch(which) {
case 1:
return new SomeClassSubclassA();
case 2:
return new SomeClassSubclassB();
...
}
}
}
}
I would like to be able to issue statements along the line of:
SomeClass x = EnclosingClass.ClassFactory.getInstance(instanceClassRequest);
Is this possible? If not, how can I access a static nested class through only the interface it implements?