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

net.n2oapp.engine.factory.MultiEngineFactory Maven / Gradle / Ivy

There is a newer version: 7.28.1
Show newest version
package net.n2oapp.engine.factory;

import java.util.List;

/**
 * Фабрика списка движков
 * @param  Тип движка
 * @param  Движок
 */
@FunctionalInterface
public interface MultiEngineFactory extends EngineFactory {

    /**
     * Отобрать список движков по типу
     * @param type Тип движка
     * @return Список движков
     */
    List produceList(T type);

    @Override
    default G produce(T type) {
        List engines = produceList(type);
        if (engines == null || engines.isEmpty())
            throw new EngineNotFoundException(type);
        if (engines.size() > 1)
            throw new EngineNotUniqueException(type);
        return engines.get(0);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy