EMMA Coverage Report (generated Mon Jan 28 10:01:43 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)80%  (4/5)96%  (44/46)91%  (10/11)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SimpleElasticsearchPersistentProperty100% (1/1)80%  (4/5)96%  (44/46)91%  (10/11)
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)

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.mapping;
17 
18import org.springframework.data.mapping.Association;
19import org.springframework.data.mapping.PersistentEntity;
20import org.springframework.data.mapping.model.AnnotationBasedPersistentProperty;
21import org.springframework.data.mapping.model.SimpleTypeHolder;
22 
23import java.beans.PropertyDescriptor;
24import java.lang.reflect.Field;
25import java.util.HashSet;
26import java.util.Set;
27 
28/**
29 * Elasticsearch specific {@link org.springframework.data.mapping.PersistentProperty} implementation processing
30 */
31public class SimpleElasticsearchPersistentProperty extends AnnotationBasedPersistentProperty<ElasticsearchPersistentProperty> implements
32                ElasticsearchPersistentProperty {
33 
34        private static final Set<Class<?>> SUPPORTED_ID_TYPES = new HashSet<Class<?>>();
35        private static final Set<String> SUPPORTED_ID_PROPERTY_NAMES = new HashSet<String>();
36 
37        static {
38                SUPPORTED_ID_TYPES.add(String.class);
39                SUPPORTED_ID_PROPERTY_NAMES.add("id");
40        SUPPORTED_ID_PROPERTY_NAMES.add("documentId");
41        }
42 
43        public SimpleElasticsearchPersistentProperty(Field field, PropertyDescriptor propertyDescriptor,
44                                                 PersistentEntity<?, ElasticsearchPersistentProperty> owner, SimpleTypeHolder simpleTypeHolder) {
45                super(field, propertyDescriptor, owner, simpleTypeHolder);
46        }
47 
48        @Override
49        public String getFieldName() {
50                return field.getName();
51        }
52 
53        @Override
54        public boolean isIdProperty() {
55                return super.isIdProperty() || SUPPORTED_ID_PROPERTY_NAMES.contains(getFieldName());
56        }
57 
58        @Override
59        protected Association<ElasticsearchPersistentProperty> createAssociation() {
60                return null;
61        }
62 
63}

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