/** * Create a new schema loader with a given loading configuration * * @param cfg the configuration * @see LoadingConfiguration * @see LoadingConfigurationBuilder */ public SchemaLoader(final LoadingConfiguration cfg) { translator = new URITranslator(cfg.getTranslatorConfiguration()); dereferencing = cfg.getDereferencing(); manager = new URIManager(cfg); preloadedSchemas = ImmutableMap.copyOf(cfg.getPreloadedSchemas()); CacheBuilder<Object, Object> builder = CacheBuilder.newBuilder(); if (cfg.getCacheSize() != -1) { builder.maximumSize(cfg.getCacheSize()); } cache = builder.build(new CacheLoader<URI, JsonNode>() { @Nonnull @Override public JsonNode load(@Nonnull final URI key) throws ProcessingException { return manager.getContent(key); } }); }
/** * Create a new schema loader with a given loading configuration * * @param cfg the configuration * @see LoadingConfiguration * @see LoadingConfigurationBuilder */ public SchemaLoader(final LoadingConfiguration cfg) { translator = new URITranslator(cfg.getTranslatorConfiguration()); dereferencing = cfg.getDereferencing(); manager = new URIManager(cfg); preloadedSchemas = ImmutableMap.copyOf(cfg.getPreloadedSchemas()); CacheBuilder<Object, Object> builder = CacheBuilder.newBuilder(); if (cfg.getCacheSize() != -1) { builder.maximumSize(cfg.getCacheSize()); } cache = builder.build(new CacheLoader<URI, JsonNode>() { @Nonnull @Override public JsonNode load(@Nonnull final URI key) throws ProcessingException { return manager.getContent(key); } }); }