@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;
    }
@ 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.

@param object object to get class of
@param <T>    object type
@return object class