public < T extends AbstractModuleConfig > T parseJSONPNCConfig ( String configContent , ConfigProvider < T > provider ) throws ConfigurationParseException { try { ObjectMapper mapper = new ObjectMapper ( ) ; provider . registerProvider ( mapper ) ; PNCModuleGroup pncGroup = getModuleGroup ( mapper , configContent , PNCModuleGroup . class ) ; for ( AbstractModuleConfig config : pncGroup . getConfigs ( ) ) { if ( config . getClass ( ) . isAssignableFrom ( provider . getType ( ) ) ) { return ( T ) config ; } } throw new ConfigurationParseException ( "Did not find config for provider " + provider . getType ( ) . getSimpleName ( ) + "." ) ; } catch ( IOException | RuntimeException e ) { log . error ( e . getMessage ( ) ) ; throw new ConfigurationParseException ( "Config could not be parsed" , e ) ; } }
Loads JSON configuration to the module configuration object