private static void populateCache() {
        if (cache == null) {
            cache = new LinkedHashMap<>();

            logger.info("IDataDecoders found:");

            ServiceLoader<IDataDecoder> loader =
                    ServiceLoader.load(IDataDecoder.class);

            // Logging.
            for (IDataDecoder discoveredDecoder : loader) {
                String name = discoveredDecoder.getClass().getCanonicalName();
                String decoderMimeType = discoveredDecoder.getMimeType();
                logger.info(String.format("    %s -> %s",
                        decoderMimeType, name));
                cache.put(decoderMimeType, discoveredDecoder.getClass());
            }
        }
    }
private static void populateCache ( ) { if ( cache == null ) { cache = new LinkedHashMap < > ( ) ; logger . info ( "IDataDecoders found:" ) ; ServiceLoader < IDataDecoder > loader = ServiceLoader . load ( IDataDecoder . class ) ; for ( IDataDecoder discoveredDecoder : loader ) { String name = discoveredDecoder . getClass ( ) . getCanonicalName ( ) ; String decoderMimeType = discoveredDecoder . getMimeType ( ) ; logger . info ( String . format ( "    %s -> %s" , decoderMimeType , name ) ) ; cache . put ( decoderMimeType , discoveredDecoder . getClass ( ) ) ; } } }
Populates the cache.