public T enhance ( T t ) { if ( ! needsEnhancement ( t ) ) { return t ; } try { return getEnhancedClass ( ) . getConstructor ( baseClass ) . newInstance ( t ) ; } catch ( Exception e ) { throw new RuntimeException ( String . format ( "Could not enhance object %s (%s)" , t , t . getClass ( ) ) , e ) ; } }
Enhances the given object .