use of io.crnk.core.engine.internal.utils.Decorator in project crnk-framework by crnk-project.
the class DefaultRegistryEntryBuilder method decorateRepository.
@SuppressWarnings({ "rawtypes", "unchecked" })
public Object decorateRepository(Object repository) {
Object decoratedRepository = repository;
List<RepositoryDecoratorFactory> repositoryDecorators = moduleRegistry.getRepositoryDecoratorFactories();
for (RepositoryDecoratorFactory repositoryDecorator : repositoryDecorators) {
Decorator decorator = null;
if (decoratedRepository instanceof RelationshipRepositoryV2) {
decorator = repositoryDecorator.decorateRepository((RelationshipRepositoryV2) decoratedRepository);
} else if (decoratedRepository instanceof ResourceRepositoryV2) {
decorator = repositoryDecorator.decorateRepository((ResourceRepositoryV2) decoratedRepository);
}
if (decorator != null) {
decorator.setDecoratedObject(decoratedRepository);
decoratedRepository = decorator;
}
}
return decoratedRepository;
}
Aggregations