@ SuppressWarnings ( "unchecked" ) public < T > T features ( Class < T > interfaceClass ) { try { for ( Method method : interfaceClass . getDeclaredMethods ( ) ) { methods . put ( method , findInvocationHandler ( method ) ) ; } return ( T ) Proxy . newProxyInstance ( interfaceClass . getClassLoader ( ) , new Class [ ] { interfaceClass } , this ) ; } catch ( NoSuchMethodException e ) { throw new PicklockException ( "cannot resolve method/property " + e . getMessage ( ) + " on " + getType ( ) ) ; } }
maps the given interface to the wrapped class