I think you're asking, "How can I determine instanceFoo's class?" but the grammar is hard to decipher.
If so, use the instanceof
operator. In your case, instanceFoo will be the attribute's parent object:
if (instanceFoo instanceof classBar){
//do stuff
}
Or you can try the getClass()
method, which is explained in detail at http://docs.oracle.com/javase/tutorial/reflect/class/classNew.html