use of io.crnk.core.module.discovery.ResourceLookup in project crnk-framework by crnk-project.
the class MetaModule method setupModule.
@Override
public void setupModule(ModuleContext context) {
this.context = context;
informationBuilder = registerInformationBuilder(context.getPropertiesProvider());
if (context.isServer()) {
context.addFilter(new DocumentFilter() {
@Override
public Response filter(DocumentFilterContext filterRequestContext, DocumentFilterChain chain) {
try {
return chain.doFilter(filterRequestContext);
} finally {
lookupRequestLocal.remove();
}
}
});
} else {
context.addResourceLookup(new ResourceLookup() {
@SuppressWarnings("unchecked")
@Override
public Set<Class<?>> getResourceClasses() {
return (Set) collectMetaClasses();
}
});
}
}
use of io.crnk.core.module.discovery.ResourceLookup in project crnk-framework by crnk-project.
the class ModuleRegistryTest method testResourceLookup.
@Test
public void testResourceLookup() throws Exception {
ResourceLookup resourceLookup = moduleRegistry.getResourceLookup();
Assert.assertFalse(resourceLookup.getResourceClasses().contains(Object.class));
Assert.assertFalse(resourceLookup.getResourceClasses().contains(String.class));
Assert.assertTrue(resourceLookup.getResourceClasses().contains(TestResource.class));
}
Aggregations