@ SuppressWarnings ( "unchecked" ) public static < T > Class < T > getInstanceClass ( final T object ) { final Class cls = object . getClass ( ) ; return cls . getName ( ) . contains ( "$$EnhancerByGuice" ) ? ( Class < T > ) cls . getSuperclass ( ) : cls ; }
Used to get correct object type even if it s guice proxy .