EMMA Coverage Report (generated Tue Mar 05 16:36:55 GMT 2013)
[all classes][org.springframework.data.elasticsearch.repository.query]

COVERAGE SUMMARY FOR SOURCE FILE [ElasticsearchQueryMethod.java]

nameclass, %method, %block, %line, %
ElasticsearchQueryMethod.java100% (1/1)100% (4/4)98%  (40/41)99%  (7.9/8)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ElasticsearchQueryMethod100% (1/1)100% (4/4)98%  (40/41)99%  (7.9/8)
getAnnotatedQuery (): String 100% (1/1)92%  (12/13)96%  (1.9/2)
ElasticsearchQueryMethod (Method, RepositoryMetadata, ElasticsearchEntityInfo... 100% (1/1)100% (15/15)100% (4/4)
getQueryAnnotation (): Query 100% (1/1)100% (6/6)100% (1/1)
hasAnnotatedQuery (): boolean 100% (1/1)100% (7/7)100% (1/1)

1/*
2 * Copyright 2013 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.repository.query;
17 
18import org.springframework.core.annotation.AnnotationUtils;
19import org.springframework.data.elasticsearch.annotations.Query;
20import org.springframework.data.elasticsearch.repository.support.ElasticsearchEntityInformation;
21import org.springframework.data.elasticsearch.repository.support.ElasticsearchEntityInformationCreator;
22import org.springframework.data.repository.core.RepositoryMetadata;
23import org.springframework.data.repository.query.QueryMethod;
24import org.springframework.util.StringUtils;
25 
26import java.lang.reflect.Method;
27 
28/**
29 *  ElasticsearchQueryMethod
30 *
31 * @author Rizwan Idrees
32 * @author Mohsin Husen
33 */
34public class ElasticsearchQueryMethod extends QueryMethod {
35 
36    private final ElasticsearchEntityInformation<?, ?> entityInformation;
37    private Method method;
38 
39    public ElasticsearchQueryMethod(Method method, RepositoryMetadata metadata, ElasticsearchEntityInformationCreator elasticsearchEntityInformationCreator) {
40        super(method, metadata);
41        this.entityInformation = elasticsearchEntityInformationCreator.getEntityInformation(metadata.getReturnedDomainClass(method));
42        this.method = method;
43    }
44 
45    public boolean hasAnnotatedQuery() {
46        return getQueryAnnotation() != null;
47    }
48 
49    public String getAnnotatedQuery() {
50        String query = (String) AnnotationUtils.getValue(getQueryAnnotation(), "value");
51        return StringUtils.hasText(query) ? query : null;
52    }
53 
54    private Query getQueryAnnotation() {
55        return this.method.getAnnotation(Query.class);
56    }
57 
58}

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