/** * Create a new {@link InitializingServiceLoader}. * * @param <T> * service type. * @param <C> * service context type. * @param serviceType * type of the services to load. * @param context * context with which to initialize the newly created service * instances. * @return an {@link InitializingServiceLoader} for type <code>T</code> */ public static <T extends Initializable<C>, C> InitializingServiceLoader<T, C> load( final Class<T> serviceType, final C context) { return new InitializingServiceLoader<>(ServiceLoader.load(serviceType), context); }
public ExporterFactoryLoader(final ExporterContext context) { this(InitializingServiceLoader.load(ExporterFactory.class, context)); }
@Override public Iterator<T> iterator() { if (this.services == null) { this.services = loadServices(); } return this.services.iterator(); }
private List<ExporterFactory> getMatchingFactories(final String format) { return StreamSupport.stream(this.serviceLoader.spliterator(), false) // .filter(f -> f.supportsFormat(format)) // .collect(toList()); }
private List<ImporterFactory> getMatchingFactories(final InputFile file) { return StreamSupport.stream(this.serviceLoader.spliterator(), false) // .filter(f -> f.supportsFile(file)) // .collect(toList()); } }
public ExporterFactoryLoader(final ExporterContext context) { this(InitializingServiceLoader.load(ExporterFactory.class, context)); }
private List<ImporterFactory> getMatchingFactories(final InputFile file) { return StreamSupport.stream(this.serviceLoader.spliterator(), false) // .filter(f -> f.supportsFile(file)) // .collect(toList()); } }
@Override public Iterator<T> iterator() { if (this.services == null) { this.services = loadServices(); } return this.services.iterator(); }
/** * Create a new {@link InitializingServiceLoader}. * * @param <T> * service type. * @param <C> * service context type. * @param serviceType * type of the services to load. * @param context * context with which to initialize the newly created service * instances. * @return an {@link InitializingServiceLoader} for type <code>T</code> */ public static <T extends Initializable<C>, C> InitializingServiceLoader<T, C> load( final Class<T> serviceType, final C context) { return new InitializingServiceLoader<>(ServiceLoader.load(serviceType), context); }
private ImporterService createImporterService(final ImportSettings settings) { final ImporterContext context = new ImporterContext(settings); final InitializingServiceLoader<ImporterFactory, ImporterContext> serviceLoader = InitializingServiceLoader .load(ImporterFactory.class, context); final ImporterService service = new ImporterServiceImpl( new ImporterFactoryLoader(serviceLoader), settings); context.setImporterService(service); return service; }
private List<ExporterFactory> getMatchingFactories(final String format) { return StreamSupport.stream(this.serviceLoader.spliterator(), false) // .filter(f -> f.supportsFormat(format)) // .collect(toList()); }
private ImporterService createImporterService(final ImportSettings settings) { final ImporterContext context = new ImporterContext(settings); final InitializingServiceLoader<ImporterFactory, ImporterContext> serviceLoader = InitializingServiceLoader .load(ImporterFactory.class, context); final ImporterService service = new ImporterServiceImpl( new ImporterFactoryLoader(serviceLoader), settings); context.setImporterService(service); return service; }