public static Class < ? > getClass ( Object obj ) { Class < ? > cls = obj . getClass ( ) ; return cls != Class . class ? cls : ( Class < ? > ) obj ; }
If the object is not a Class get its Class . Otherwise get the object as a Class .