~ubuntu-branches/ubuntu/trusty/ehcache/trusty

« back to all changes in this revision

Viewing changes to src/main/java/net/sf/ehcache/CacheQuery.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2013-05-06 14:53:07 UTC
  • mfrom: (1.1.7) (2.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20130506145307-v5bhw5yu70re00l3
Tags: 2.6.7-1
* Team upload.
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 *  Copyright 2003-2010 Terracotta, Inc.
 
2
 *  Copyright Terracotta, Inc.
3
3
 *
4
4
 *  Licensed under the Apache License, Version 2.0 (the "License");
5
5
 *  you may not use this file except in compliance with the License.
50
50
    private final Set<Attribute<?>> includedAttributes = Collections.synchronizedSet(new HashSet<Attribute<?>>());
51
51
    private final List<Criteria> criteria = Collections.synchronizedList(new ArrayList<Criteria>());
52
52
    private final List<Aggregator> aggregators = Collections.synchronizedList(new ArrayList<Aggregator>());
 
53
    private final Set<Attribute<?>> groupByAttributes = Collections.synchronizedSet(new HashSet<Attribute<?>>());
 
54
 
53
55
    private final Cache cache;
54
56
 
55
57
    /**
133
135
    /**
134
136
     * {@inheritDoc}
135
137
     */
 
138
    public Query addGroupBy(Attribute<?>... attributes) {
 
139
        checkFrozen();
 
140
 
 
141
        if (attributes == null) {
 
142
            throw new NullPointerException();
 
143
        }
 
144
 
 
145
        for (Attribute<?> attribute : attributes) {
 
146
            if (attribute == null) {
 
147
                throw new NullPointerException("null attribute");
 
148
            }
 
149
            groupByAttributes.add(attribute);
 
150
        }
 
151
        return this;
 
152
    }
 
153
 
 
154
    /**
 
155
     * {@inheritDoc}
 
156
     */
136
157
    public Query maxResults(int maxResults) {
137
158
        checkFrozen();
138
159
        this.maxResults = maxResults;
219
240
    /**
220
241
     * {@inheritDoc}
221
242
     */
 
243
    public Set<Attribute<?>> groupByAttributes() {
 
244
        assertFrozen();
 
245
        return Collections.unmodifiableSet(this.groupByAttributes);
 
246
    }
 
247
 
 
248
    /**
 
249
     * {@inheritDoc}
 
250
     */
222
251
    public int maxResults() {
223
252
        assertFrozen();
224
253
        return maxResults;
280
309
        private final int copiedMaxResults = maxResults;
281
310
        private final List<Ordering> copiedOrdering = Collections.unmodifiableList(new ArrayList<Ordering>(orderings));
282
311
        private final List<AggregatorInstance<?>> copiedAggregators = Collections.unmodifiableList(createAggregatorInstances(aggregators));
 
312
        private final Set<Attribute<?>> copiedGroupByAttributes = Collections.unmodifiableSet(new HashSet<Attribute<?>>(groupByAttributes));
283
313
 
284
314
        public Criteria getCriteria() {
285
315
            return copiedCriteria;
301
331
            return copiedAttributes;
302
332
        }
303
333
 
 
334
        public Set<Attribute<?>> groupByAttributes() {
 
335
            return copiedGroupByAttributes;
 
336
        }
 
337
 
304
338
        public int maxResults() {
305
339
            return copiedMaxResults;
306
340
        }