@ SuppressWarnings ( "unchecked" ) public < Input , Output > Output adapt ( Input input , Class < Output > outputType ) throws Exception { Class < ? > inputType = input . getClass ( ) ; Adapter a = findAdapter ( input , inputType , outputType ) ; if ( a == null ) return null ; return ( Output ) a . adapt ( input ) ; }
Find an adapter that can adapt the given input into the given output type and adapt it or return null if no available adapter can be found .