|
32 | 32 | import org.springframework.core.io.ClassPathResource;
|
33 | 33 | import org.springframework.data.annotation.Transient;
|
34 | 34 | import org.springframework.data.elasticsearch.annotations.*;
|
| 35 | +import org.springframework.data.elasticsearch.annotations.Field; |
35 | 36 | import org.springframework.data.elasticsearch.core.completion.Completion;
|
36 | 37 | import org.springframework.data.elasticsearch.core.geo.GeoPoint;
|
37 | 38 | import org.springframework.data.mapping.model.SimpleTypeHolder;
|
|
45 | 46 | * @author Kevin Leturc
|
46 | 47 | * @author Alexander Volz
|
47 | 48 | * @author Dennis Maaß
|
| 49 | + * @author Pavel Luhin |
48 | 50 | */
|
49 | 51 |
|
50 | 52 | class MappingBuilder {
|
@@ -108,7 +110,7 @@ private static void mapEntity(XContentBuilder xContentBuilder, Class clazz, bool
|
108 | 110 |
|
109 | 111 | for (java.lang.reflect.Field field : fields) {
|
110 | 112 |
|
111 |
| - if (field.isAnnotationPresent(Transient.class) || isInIgnoreFields(field)) { |
| 113 | + if (field.isAnnotationPresent(Transient.class) || isInIgnoreFields(field, fieldAnnotation)) { |
112 | 114 | continue;
|
113 | 115 | }
|
114 | 116 |
|
@@ -336,10 +338,9 @@ private static boolean isIdField(java.lang.reflect.Field field, String idFieldNa
|
336 | 338 | return idFieldName.equals(field.getName());
|
337 | 339 | }
|
338 | 340 |
|
339 |
| - private static boolean isInIgnoreFields(java.lang.reflect.Field field) { |
340 |
| - Field fieldAnnotation = field.getAnnotation(Field.class); |
341 |
| - if (null != fieldAnnotation) { |
342 |
| - String[] ignoreFields = fieldAnnotation.ignoreFields(); |
| 341 | + private static boolean isInIgnoreFields(java.lang.reflect.Field field, Field parentFieldAnnotation) { |
| 342 | + if (null != parentFieldAnnotation) { |
| 343 | + String[] ignoreFields = parentFieldAnnotation.ignoreFields(); |
343 | 344 | return Arrays.asList(ignoreFields).contains(field.getName());
|
344 | 345 | }
|
345 | 346 | return false;
|
|
0 commit comments