use of io.crnk.core.module.Module.ModuleContext in project crnk-framework by crnk-project.
the class MetaLookup method addProvider.
public void addProvider(MetaProvider provider) {
providers.add(provider);
provider.init(new MetaProviderContext() {
@Override
public ModuleContext getModuleContext() {
return moduleContext;
}
@Override
public Optional<MetaElement> getMetaElement(String id) {
return Optional.ofNullable(idElementMap.get(id));
}
@Override
public void checkInitialized() {
MetaLookup.this.checkInitialized();
}
@Override
public <T> T runDiscovery(Callable<T> callable) {
return discover(callable);
}
});
for (MetaFilter filter : provider.getFilters()) {
addFilter(filter);
}
for (MetaPartition partition : provider.getPartitions()) {
addPartition(partition);
}
metaTypes.addAll(provider.getMetaTypes());
}
Aggregations