Skip to content

Commit 89730fe

Browse files
anton-martynovmohsinh
authored andcommitted
DATAES-125 - The name of the isAnnotated method doesn't correspond to method body
1 parent 1ea9920 commit 89730fe

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

src/main/java/org/springframework/data/elasticsearch/core/MappingBuilder.java

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ private static void mapEntity(XContentBuilder xContentBuilder, Class clazz, bool
9494
boolean isGeoField = isGeoField(field);
9595

9696
Field singleField = field.getAnnotation(Field.class);
97-
if (!isGeoField && isEntity(field) && !isAnnotated(field)) {
97+
if (!isGeoField && isEntity(field) && isAnnotated(field)) {
9898
if (singleField == null) {
9999
continue;
100100
}
101101
boolean nestedOrObject = isNestedOrObjectField(field);
102-
mapEntity(xContentBuilder, getFieldType(field), false, EMPTY, field.getName(), nestedOrObject, field.getAnnotation(Field.class).type());
102+
mapEntity(xContentBuilder, getFieldType(field), false, EMPTY, field.getName(), nestedOrObject, singleField.type());
103103
if (nestedOrObject) {
104104
continue;
105105
}
@@ -126,7 +126,7 @@ private static void mapEntity(XContentBuilder xContentBuilder, Class clazz, bool
126126
}
127127

128128
private static boolean isAnnotated(java.lang.reflect.Field field) {
129-
return field.getAnnotation(Field.class) == null && field.getAnnotation(MultiField.class) == null && field.getAnnotation(GeoPointField.class) == null;
129+
return field.getAnnotation(Field.class) != null || field.getAnnotation(MultiField.class) != null || field.getAnnotation(GeoPointField.class) != null;
130130
}
131131

132132
private static void applyGeoPointFieldMapping(XContentBuilder xContentBuilder, java.lang.reflect.Field field) throws IOException {
@@ -146,9 +146,6 @@ private static void applyDefaultIdFieldMapping(XContentBuilder xContentBuilder,
146146
/**
147147
* Apply mapping for a single @Field annotation
148148
*
149-
* @param xContentBuilder
150-
* @param field
151-
* @param fieldAnnotation
152149
* @throws IOException
153150
*/
154151
private static void addSingleFieldMapping(XContentBuilder xContentBuilder, java.lang.reflect.Field field,
@@ -177,9 +174,6 @@ private static void addSingleFieldMapping(XContentBuilder xContentBuilder, java.
177174
/**
178175
* Apply mapping for a single nested @Field annotation
179176
*
180-
* @param builder
181-
* @param field
182-
* @param annotation
183177
* @throws IOException
184178
*/
185179
private static void addNestedFieldMapping(XContentBuilder builder, java.lang.reflect.Field field,
@@ -204,9 +198,6 @@ private static void addNestedFieldMapping(XContentBuilder builder, java.lang.ref
204198
/**
205199
* Multi field mappings for string type fields, support for sorts and facets
206200
*
207-
* @param builder
208-
* @param field
209-
* @param annotation
210201
* @throws IOException
211202
*/
212203
private static void addMultiFieldMapping(XContentBuilder builder, java.lang.reflect.Field field,
@@ -226,9 +217,6 @@ private static void addMultiFieldMapping(XContentBuilder builder, java.lang.refl
226217
/**
227218
* Facet field for string type, for other types we don't need it(long, int, double, float)
228219
*
229-
* @param builder
230-
* @param field
231-
* @param annotation
232220
* @throws IOException
233221
*/
234222
private static void addFacetMapping(XContentBuilder builder, java.lang.reflect.Field field, Field annotation) throws IOException {
@@ -243,9 +231,6 @@ private static void addFacetMapping(XContentBuilder builder, java.lang.reflect.F
243231
* Sort field for string type, for other types we don't need it(long, int, double, float)
244232
* value of the field should be converted to lowercase and not analise
245233
*
246-
* @param builder
247-
* @param field
248-
* @param annotation
249234
* @throws IOException
250235
*/
251236
private static void addSortMapping(XContentBuilder builder, java.lang.reflect.Field field, Field annotation) throws IOException {

0 commit comments

Comments
 (0)