use of org.immutables.criteria.backend.KeyExtractor in project immutables by immutables.
the class KeyLookupAnalyzerTest method ids.
private static Iterable<String> ids(StringHolderCriteria crit) {
Expression filter = Criterias.toQuery(crit).filter().orElseThrow(() -> new AssertionError("No filter present"));
KeyExtractor extractor = KeyExtractor.defaultFactory().create(TypeHolder.StringHolder.class);
KeyLookupAnalyzer analyzer = KeyLookupAnalyzer.fromExtractor(extractor);
KeyLookupAnalyzer.Result result = analyzer.analyze(filter);
if (!result.isOptimizable()) {
return Collections.emptyList();
}
return (Iterable<String>) result.values();
}
use of org.immutables.criteria.backend.KeyExtractor in project immutables by immutables.
the class MongoBackend method open.
@Override
public Session open(Class<?> entityType) {
Objects.requireNonNull(entityType, "context");
KeyExtractor keyExtractor = keyExtractorFactory.create(entityType);
return new MongoSession(collectionResolver.resolve(entityType), keyExtractor);
}
Aggregations