public static < T extends MPBase > T manage ( Topic topic , String id ) throws MPException { if ( topic == null || id == null ) { throw new MPException ( "Topic and Id can not be null in the IPN request" ) ; } T resourceObject = null ; Class clazz = null ; Method method = null ; try { clazz = Class . forName ( topic . getResourceClassName ( ) ) ; if ( ! MPBase . class . isAssignableFrom ( clazz ) ) { throw new MPException ( topic . toString ( ) + " does not extend from MPBase" ) ; } method = clazz . getMethod ( "findById" , String . class ) ; resourceObject = ( T ) method . invoke ( null , id ) ; } catch ( Exception ex ) { throw new MPException ( ex ) ; } return resourceObject ; }
It manages an IPN and returns a resource