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; + } + }