EMMA Coverage Report (generated Mon Jan 28 10:01:43 GMT 2013)
[all classes][org.springframework.data.elasticsearch.core.query]

COVERAGE SUMMARY FOR SOURCE FILE [AbstractQuery.java]

nameclass, %method, %block, %line, %
AbstractQuery.java100% (1/1)100% (6/6)69%  (33/48)71%  (10/14)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractQuery100% (1/1)100% (6/6)69%  (33/48)71%  (10/14)
addSort (Sort): Query 100% (1/1)21%  (4/19)33%  (2/6)
<static initializer> 100% (1/1)100% (7/7)100% (1/1)
AbstractQuery (): void 100% (1/1)100% (6/6)100% (2/2)
getPageable (): Pageable 100% (1/1)100% (3/3)100% (1/1)
getSort (): Sort 100% (1/1)100% (3/3)100% (1/1)
setPageable (Pageable): Query 100% (1/1)100% (10/10)100% (3/3)

1/*
2 * Copyright 2012 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.springframework.data.elasticsearch.core.query;
17 
18import org.springframework.data.domain.PageRequest;
19import org.springframework.data.domain.Pageable;
20import org.springframework.data.domain.Sort;
21import org.springframework.util.Assert;
22 
23/**
24 * AbstractQuery
25 * 
26 */
27abstract class AbstractQuery  implements Query{
28 
29    private static final Pageable DEFAULT_PAGE = new PageRequest(0, DEFAULT_PAGE_SIZE);
30 
31    protected Pageable pageable = DEFAULT_PAGE;
32    protected Sort sort;
33 
34    @Override
35    public Sort getSort() {
36        return this.sort;
37    }
38 
39    @Override
40    public Pageable getPageable() {
41        return this.pageable;
42    }
43 
44    @Override
45    public final <T extends Query> T setPageable(Pageable pageable) {
46        Assert.notNull(pageable);
47 
48        this.pageable = pageable;
49        return (T) this.addSort(pageable.getSort());
50    }
51 
52    @SuppressWarnings("unchecked")
53    public final <T extends Query> T addSort(Sort sort) {
54        if (sort == null) {
55            return (T) this;
56        }
57 
58        if (this.sort == null) {
59            this.sort = sort;
60        } else {
61            this.sort = this.sort.and(sort);
62        }
63 
64        return (T) this;
65    }
66 
67}

[all classes][org.springframework.data.elasticsearch.core.query]
EMMA 2.0.5312 (C) Vladimir Roubtsov