DATAES-784 - MappingBuilder should use @Field annotation with custom value objects.

Original PR: #423
This commit is contained in:
Peter-Josef Meisch
2020-04-07 14:40:41 +02:00
committed by GitHub
parent 3afd6fd427
commit bbc9ec213a
2 changed files with 46 additions and 16 deletions

View File

@@ -545,6 +545,21 @@ public class MappingBuilderTests extends MappingContextBaseTests {
assertEquals(expected, mapping, true);
}
@Test // DATAES-784
void shouldMapPropertyObjectsToFieldDefinition() throws JSONException {
String expected = "{\n" + //
" properties: {\n" + //
" valueObject: {\n" + //
" type: \"text\"\n" + //
" }\n" + //
" }\n" + //
"}";
String mapping = getMappingBuilder().buildPropertyMapping(ValueDoc.class);
assertEquals(expected, mapping, true);
}
/**
* @author Xiao Yu
*/
@@ -997,4 +1012,21 @@ public class MappingBuilderTests extends MappingContextBaseTests {
this.author = author;
}
}
static class ValueObject {
private String value;
public ValueObject(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}
@Document(indexName = "valueDoc")
static class ValueDoc {
@Field(type = Text) private ValueObject valueObject;
}
}