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

COVERAGE SUMMARY FOR SOURCE FILE [SimpleElasticsearchPersistentProperty.java]

nameclass, %method, %block, %line, %
SimpleElasticsearchPersistentProperty.java100% (1/1)83%  (5/6)96%  (49/51)92%  (11/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SimpleElasticsearchPersistentProperty100% (1/1)83%  (5/6)96%  (49/51)92%  (11/12)
createAssociation (): Association 0%   (0/1)0%   (0/2)0%   (0/1)
<static initializer> 100% (1/1)100% (21/21)100% (6/6)
SimpleElasticsearchPersistentProperty (Field, PropertyDescriptor, PersistentE... 100% (1/1)100% (7/7)100% (2/2)
getFieldName (): String 100% (1/1)100% (4/4)100% (1/1)
isIdProperty (): boolean 100% (1/1)100% (12/12)100% (1/1)
isVersionProperty (): boolean 100% (1/1)100% (5/5)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.core.mapping;
17 
18import org.springframework.data.elasticsearch.annotations.Version;
19import org.springframework.data.mapping.Association;
20import org.springframework.data.mapping.PersistentEntity;
21import org.springframework.data.mapping.model.AnnotationBasedPersistentProperty;
22import org.springframework.data.mapping.model.SimpleTypeHolder;
23 
24import java.beans.PropertyDescriptor;
25import java.lang.reflect.Field;
26import java.util.HashSet;
27import java.util.Set;
28 
29/**
30 * Elasticsearch specific {@link org.springframework.data.mapping.PersistentProperty} implementation processing
31 *
32 * @author Rizwan Idrees
33 * @author Mohsin Husen
34 */
35public class SimpleElasticsearchPersistentProperty extends AnnotationBasedPersistentProperty<ElasticsearchPersistentProperty> implements
36                ElasticsearchPersistentProperty {
37 
38        private static final Set<Class<?>> SUPPORTED_ID_TYPES = new HashSet<Class<?>>();
39        private static final Set<String> SUPPORTED_ID_PROPERTY_NAMES = new HashSet<String>();
40 
41        static {
42                SUPPORTED_ID_TYPES.add(String.class);
43                SUPPORTED_ID_PROPERTY_NAMES.add("id");
44        SUPPORTED_ID_PROPERTY_NAMES.add("documentId");
45        }
46 
47        public SimpleElasticsearchPersistentProperty(Field field, PropertyDescriptor propertyDescriptor,
48                                                 PersistentEntity<?, ElasticsearchPersistentProperty> owner, SimpleTypeHolder simpleTypeHolder) {
49                super(field, propertyDescriptor, owner, simpleTypeHolder);
50        }
51 
52        @Override
53        public String getFieldName() {
54                return field.getName();
55        }
56 
57        @Override
58        public boolean isIdProperty() {
59                return super.isIdProperty() || SUPPORTED_ID_PROPERTY_NAMES.contains(getFieldName());
60        }
61 
62    @Override
63    public boolean isVersionProperty(){
64        return field.isAnnotationPresent(Version.class);
65    }
66 
67    @Override
68        protected Association<ElasticsearchPersistentProperty> createAssociation() {
69                return null;
70        }
71 
72}

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