EMMA Coverage Report (generated Mon Jan 28 16:15:17 GMT 2013)
[all classes][org.springframework.data.elasticsearch.repository.cdi]

COVERAGE SUMMARY FOR SOURCE FILE [ElasticsearchRepositoryBean.java]

nameclass, %method, %block, %line, %
ElasticsearchRepositoryBean.java0%   (0/1)0%   (0/3)0%   (0/30)0%   (0/7)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ElasticsearchRepositoryBean0%   (0/1)0%   (0/3)0%   (0/30)0%   (0/7)
ElasticsearchRepositoryBean (Bean, Set, Class, BeanManager): void 0%   (0/1)0%   (0/12)0%   (0/4)
create (CreationalContext, Class): Object 0%   (0/1)0%   (0/14)0%   (0/2)
getScope (): Class 0%   (0/1)0%   (0/4)0%   (0/1)

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.repository.cdi;
17 
18import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
19import org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactory;
20import org.springframework.data.repository.cdi.CdiRepositoryBean;
21import org.springframework.util.Assert;
22 
23import javax.enterprise.context.spi.CreationalContext;
24import javax.enterprise.inject.spi.Bean;
25import javax.enterprise.inject.spi.BeanManager;
26import java.lang.annotation.Annotation;
27import java.util.Set;
28 
29/**
30 * Uses CdiRepositoryBean to create ElasticsearchRepository instances.
31 * 
32 */
33public class ElasticsearchRepositoryBean<T> extends CdiRepositoryBean<T> {
34 
35        private final Bean<ElasticsearchOperations> elasticsearchOperationsBean;
36 
37        public ElasticsearchRepositoryBean(Bean<ElasticsearchOperations> operations, Set<Annotation> qualifiers, Class<T> repositoryType,
38                                       BeanManager beanManager) {
39                super(qualifiers, repositoryType, beanManager);
40 
41                Assert.notNull(operations, "Cannot create repository with 'null' for ElasticsearchOperations.");
42                this.elasticsearchOperationsBean = operations;
43        }
44 
45        @Override
46        protected T create(CreationalContext<T> creationalContext, Class<T> repositoryType) {
47        ElasticsearchOperations elasticsearchOperations = getDependencyInstance(elasticsearchOperationsBean, ElasticsearchOperations.class);
48                return new ElasticsearchRepositoryFactory(elasticsearchOperations).getRepository(repositoryType);
49        }
50 
51        @Override
52        public Class<? extends Annotation> getScope() {
53                return elasticsearchOperationsBean.getScope();
54        }
55 
56}

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