@Test public void testGetNestedPath_01() throws NoSuchFieldException { String path = "addressBook.country.name"; String nested = personInfo.getNestedPath(path); assertEquals("01", "addressBook", nested); }
public static String getNestedPath(ESField field) { List<ComplexField> in = getAncestors(field); List<ComplexField> out; for (int i = 0; i < in.size(); ++i) { ComplexField d = in.get(i); if (d.getType() == NESTED) { out = in.subList(i, in.size()); Collections.reverse(out); return CollectionUtil.implode(out, ".", new Stringifier<ComplexField>() { public String execute(ComplexField doc, Object... args) { return doc.getName(); } }); } } return null; }
MappingInfo { public static String getNestedPath(ESField field) { List<ComplexField> in = getAncestors(field); List<ComplexField> out; for (int i = 0; i < in.size(); ++i) { ComplexField d = in.get(i); if (d.getType() == NESTED) { out = in.subList(i, in.size()); Collections.reverse(out); return CollectionUtil.implode(out, ".", new Stringifier<ComplexField>() { public String execute(ComplexField doc, Object... args) { return doc.getName(); } }); } } return null; } }
MappingInfo { public static String getNestedPath(ESField field) { List<ComplexField> in = getAncestors(field); List<ComplexField> out; for (int i = 0; i < in.size(); ++i) { ComplexField d = in.get(i); if (d.getType() == NESTED) { out = in.subList(i, in.size()); Collections.reverse(out); return CollectionUtil.implode(out, ".", new Stringifier<ComplexField>() { public String execute(ComplexField doc, Object... args) { return doc.getName(); } }); } } return null; } MappingInfo(Mapping<T> mapping); }
MappingInfo { public static String getNestedPath(ESField field) { List<ComplexField> in = getAncestors(field); List<ComplexField> out; for (int i = 0; i < in.size(); ++i) { ComplexField d = in.get(i); if (d.getType() == NESTED) { out = in.subList(i, in.size()); Collections.reverse(out); return CollectionUtil.implode(out, ".", new Stringifier<ComplexField>() { public String execute(ComplexField doc, Object... args) { return doc.getName(); } }); } } return null; } MappingInfo(Mapping<T> mapping); static boolean isOrDescendsFromArray(ESField field); static List<ComplexField> getAncestors(ESField field); static String getNestedPath(ESField field); Mapping<T> getMapping(); ESField getField(String path); ESField getField(Path path); ESDataType getType(String path); List<ComplexField> getAncestors(String path); String getNestedPath(String path); String[] getPathStrings(boolean sorted); boolean isOrDescendsFromArray(String path); }
MappingInfo { public static String getNestedPath(ESField field) { List<ComplexField> in = getAncestors(field); List<ComplexField> out; for (int i = 0; i < in.size(); ++i) { ComplexField d = in.get(i); if (d.getType() == NESTED) { out = in.subList(i, in.size()); Collections.reverse(out); return CollectionUtil.implode(out, ".", new Stringifier<ComplexField>() { public String execute(ComplexField doc, Object... args) { return doc.getName(); } }); } } return null; } MappingInfo(Mapping<T> mapping); static boolean isOrDescendsFromArray(ESField field); static List<ComplexField> getAncestors(ESField field); static String getNestedPath(ESField field); Mapping<T> getMapping(); ESField getField(String path); ESField getField(Path path); ESDataType getType(String path); List<ComplexField> getAncestors(String path); String getNestedPath(String path); String[] getPathStrings(boolean sorted); boolean isOrDescendsFromArray(String path);  }