DATAES-784 - MappingBuilder should use @Field annotation with custom value objects.
Original PR: #423
This commit is contained in:
committed by
GitHub
parent
3afd6fd427
commit
bbc9ec213a
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user