Is there a way to modify the getObjects() method so it doesn't return subclasses of the class it should return?
List<Apple> l = getObjects();
List<Apple> filtered = new ArrayList<Apple>();
for (Apple a : l) {
if (a.getClass() == Apple.class) {
// a is an Apple, but not a subclass of Apple
filtered.add(a);
}
}