Новый метод получения репозитория из сервиса
This commit is contained in:
parent
cca5a4ad25
commit
06a7131aba
@ -11,4 +11,6 @@ public interface UnitService {
|
||||
|
||||
void addUnitRepository(UnitRepository unitRepository);
|
||||
|
||||
UnitRepository getUnitRepository(Class clazz);
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user