public < T extends BaseBugLinkStrategy < ? > > T create ( final BugLinkType type , final String serverUrl , final Object ... additionalArgs ) { // Check that the internals are registered if ( ! internalsRegistered ) { registerInternals ( ) ; } if ( map . containsKey ( type ) ) { try { final SortedSet < Helper > helpers = map . get ( type ) ; T helper = null ; for ( final Helper definedHelper : helpers ) { if ( definedHelper . useHelper ( serverUrl ) ) { helper = ( T ) definedHelper . getHelperClass ( ) . newInstance ( ) ; break ; } } if ( helper != null ) { helper . initialise ( serverUrl , additionalArgs ) ; } return helper ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } else { return null ; } }
Create a strategy instance to be used for the specified type and server url .