use of org.infinispan.commons.dataconversion.MediaType.APPLICATION_PROTOSTREAM in project infinispan by infinispan.
the class ObjectRemoteQueryManager method createEntityNamesResolver.
private EntityNameResolver<Class<?>> createEntityNamesResolver(MediaType mediaType) {
if (mediaType.match(APPLICATION_PROTOSTREAM)) {
return new ProtobufEntityNameResolver(serCtx);
} else {
ClassLoader classLoader = cr.getGlobalComponentRegistry().getComponent(ClassLoader.class);
ReflectionEntityNamesResolver reflectionEntityNamesResolver = new ReflectionEntityNamesResolver(classLoader);
if (searchMapping != null) {
// If indexing is enabled then use the declared set of indexed classes for lookup but fallback to global classloader.
QueryInterceptor queryInterceptor = cr.getComponent(QueryInterceptor.class);
Map<String, Class<?>> indexedEntities = queryInterceptor.indexedEntities();
return name -> {
Class<?> c = indexedEntities.get(name);
if (c == null) {
c = reflectionEntityNamesResolver.resolve(name);
}
return c;
};
}
return reflectionEntityNamesResolver;
}
}
Aggregations