/
javapractice
/
JavaPractice
Обзор
Документация
Войти
/
javapractice
/
JavaPractice
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
2
CI/CD
Аналитика
develop
bar/src/main/java/functionIntr/consumer/SellWorkflowImpl.java
42 строки
1 KB
Кузьма Даждъбогин
TSKJVPRCTC5-7 Вынес практику по функциональным интерфейсам в отедльный модуль Слитки
17 фев 2026, 12:32
17 фев 2026, 12:32
5dd264a
Код
Авторство
О чём код?
package functionIntr.consumer; import functionIntr.function.SellRequestMapper; import history.SellHistoryImpl; import request.SellRequest; import java.util.function.BiFunction; import java.util.function.Supplier; public class SellWorkflowImpl implements Workflow<SellRequest, SellHistoryImpl> { private final Supplier<SellRequest> requestSupplier = SellRequest::new; private final Supplier<SellHistoryImpl> historySupplier = SellHistoryImpl::new; private final BiFunction<SellRequest, SellHistoryImpl, SellRequest> sellRequestMapper = new SellRequestMapper()::map; @Override public SellRequest doInitialisation() { SellRequest sellRequest = requestSupplier.get(); System.out.println("Создан новый " + sellRequest); return sellRequest; } @Override public SellRequest doFillingByHistory(SellRequest request, SellHistoryImpl history) { sellRequestMapper.apply(request, history); System.out.println("Реквест заполнен данными из ИО. Состояние реквеста: " + request); return request; } @Override public void doFinish(SellRequest request) { System.out.println("продано клиенту: " + request); } @Override public SellHistoryImpl doDatabase(Supplier<SellHistoryImpl> historySupplier) { return null; } public Supplier<SellHistoryImpl> getHistorySupplier() { return historySupplier; } }