return new QueryResultImpl(cache.entrySet(filter, comparator), skip, limit);
}
} else {
InvocableMap.EntryAggregator aggregator;
if (projection.length == 1) {
aggregator = new ReducerAggregator(projection[0]);
} else {
ValueExtractor[] extractors = new ValueExtractor[projection.length];
for (int i = 0; i < projection.length; ++i) {
extractors[i] = projection[i].indexOf('.') < 0 ? new ReflectionExtractor(projection[i]) : new ChainedExtractor(projection[i]);
}
aggregator = new ReducerAggregator(new MultiExtractor(extractors));
}
Map map;
if (comparator != null || skip > 0 || limit >= 0) {
int laLimit = limit < 0 ? Integer.MAX_VALUE : limit + skip;
map = (Map) cache.aggregate(filter, new LimitAggregator(aggregator, laLimit, comparator != null, comparator, EntryComparator.CMP_VALUE));