Test if object is instanceof a parameter type

The only way you can do this check is if you have the Class object representing the type:

Class<T> type; //maybe passed into the method
if ( type.isInstance(obj) ) {
   //...
}

Leave a Comment