All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.asewhy.exchange.base.ExchangeSimpleTaskFactory Maven / Gradle / Ivy

The newest version!
package io.github.asewhy.exchange.base;

import io.github.asewhy.exchange.support.ExchangeTaskFactory;

import java.util.function.Supplier;

/**
 * Класс фабрики задач
 * @param  тип задачи
 */
public class ExchangeSimpleTaskFactory implements ExchangeTaskFactory {

    /** Метод, возвращающий задачу экспорта */
    protected final Supplier> supplier;

    /** Тип задачи */
    protected final Class> taskType;

    /**
     * Конструктор простой фабрики задач
     * @param supplier метод, возвращающий новую задачу экспорта
     * @param taskType тип задачи
     */
    public ExchangeSimpleTaskFactory(Supplier> supplier, Class> taskType) {
        this.supplier = supplier;
        this.taskType = taskType;
    }

    @Override
    public ExchangeProcessorTask create() {
        return supplier.get();
    }

    @Override
    public Class> getType() {
        return taskType;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy