I've referenced a Terrain.class from a List, and I need to check if it's actually a subclass of Terrain. Is there any way to do that, or do I have to check for every individual class?
EDIT:
You may use someObject.getClass().getSuperclass() and check if that's Terrain. I guess that may only work for single level difference in inheritance from Terrain.
You can use 'if (someObject instanceof SubclassName)'; but you will have to check each subclass (unless you know what subclass you are looking for).
If you add a 'id' field in the Terrain class and set it differently in each of the subclasses, you can then reference it to determine what class it is.
"if (someObject instanceof SubclassName);" should be sufficient. I'm just seeing if the object is a certain class, and if it is, then get certain information and save it in a specific format as a String for an algorithm.