public static Binder binder ( Object module ) { if ( module instanceof AbstractModule ) { try { Method method = AbstractModule . class . getDeclaredMethod ( "binder" ) ; if ( ! method . isAccessible ( ) ) { method . setAccessible ( true ) ; } return ( Binder ) method . invoke ( module ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } else { throw new IllegalArgumentException ( "Module must be an instance of AbstractModule" ) ; } }
Get the binder from an AbstractModule .