From 06a7131aba15386ff3c86fe8573c57652866d690 Mon Sep 17 00:00:00 2001 From: Mark Struchkov Date: Mon, 21 Jan 2019 11:25:42 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D1=8B=D0=B9=20=D0=BC=D0=B5?= =?UTF-8?q?=D1=82=D0=BE=D0=B4=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D1=80=D0=B5=D0=BF=D0=BE=D0=B7=D0=B8=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D1=8F=20=D0=B8=D0=B7=20=D1=81=D0=B5=D1=80=D0=B2?= =?UTF-8?q?=D0=B8=D1=81=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/sadtech/autoresponder/service/UnitService.java | 2 ++ .../autoresponder/service/impl/UnitServiceImpl.java | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/org/sadtech/autoresponder/service/UnitService.java b/src/main/java/org/sadtech/autoresponder/service/UnitService.java index 45285af..6f668d2 100644 --- a/src/main/java/org/sadtech/autoresponder/service/UnitService.java +++ b/src/main/java/org/sadtech/autoresponder/service/UnitService.java @@ -11,4 +11,6 @@ public interface UnitService { void addUnitRepository(UnitRepository unitRepository); + UnitRepository getUnitRepository(Class clazz); + } diff --git a/src/main/java/org/sadtech/autoresponder/service/impl/UnitServiceImpl.java b/src/main/java/org/sadtech/autoresponder/service/impl/UnitServiceImpl.java index 3a975bb..0248564 100644 --- a/src/main/java/org/sadtech/autoresponder/service/impl/UnitServiceImpl.java +++ b/src/main/java/org/sadtech/autoresponder/service/impl/UnitServiceImpl.java @@ -35,6 +35,16 @@ public class UnitServiceImpl implements UnitService { unitRepositories.add(unitRepository); } + @Override + public UnitRepository getUnitRepository(Class clazz) { + for (UnitRepository unitRepository : unitRepositories) { + if (unitRepository.getClass().equals(clazz)) { + return unitRepository; + } + } + return null; + } + }