@Test public void testReadNumericField() { properties.put("attr", 2.3); List<Object> values = parserUtil.readField(properties, "attr"); assertEquals(1, values.size()); assertEquals(2.3, values.get(0)); }
public List<Object> readField(Map<String, Object> source, String name) { final List<String> keys = Arrays.asList(name.split("\\.")); List<Object> values = new ArrayList<>(); if (!keys.isEmpty()) { final Object entry = source.get(keys.get(0)); if (entry == null) { readField(source.get(name), new ArrayList<>(), values); } else { readField(entry, keys.subList(1, keys.size()), values); } } final List<Object> result; if (!values.isEmpty()) { result = values; } else { result = null; } return result; }
ElasticParserUtil { public List<Object> readField(Map<String, Object> source, String name) { final List<String> keys = Arrays.asList(name.split("\\.")); List<Object> values = new ArrayList<>(); if (!keys.isEmpty()) { final Object entry = source.get(keys.get(0)); if (entry == null) { readField(source.get(name), new ArrayList<>(), values); } else { readField(entry, keys.subList(1, keys.size()), values); } } final List<Object> result; if (!values.isEmpty()) { result = values; } else { result = null; } return result; } }
ElasticParserUtil { public List<Object> readField(Map<String, Object> source, String name) { final List<String> keys = Arrays.asList(name.split("\\.")); List<Object> values = new ArrayList<>(); if (!keys.isEmpty()) { final Object entry = source.get(keys.get(0)); if (entry == null) { readField(source.get(name), new ArrayList<>(), values); } else { readField(entry, keys.subList(1, keys.size()), values); } } final List<Object> result; if (!values.isEmpty()) { result = values; } else { result = null; } return result; } ElasticParserUtil(); }
ElasticParserUtil { public List<Object> readField(Map<String, Object> source, String name) { final List<String> keys = Arrays.asList(name.split("\\.")); List<Object> values = new ArrayList<>(); if (!keys.isEmpty()) { final Object entry = source.get(keys.get(0)); if (entry == null) { readField(source.get(name), new ArrayList<>(), values); } else { readField(entry, keys.subList(1, keys.size()), values); } } final List<Object> result; if (!values.isEmpty()) { result = values; } else { result = null; } return result; } ElasticParserUtil(); @SuppressWarnings("unchecked") Geometry createGeometry(Object obj); @SuppressWarnings({"rawtypes", "unchecked"}) Geometry createGeometry(final Map<String, Object> properties); List<Object> readField(Map<String, Object> source, String name); @SuppressWarnings("rawtypes") static boolean isGeoPointFeature(Map<String, Object> map); static String urlDecode(String value); }
ElasticParserUtil { public List<Object> readField(Map<String, Object> source, String name) { final List<String> keys = Arrays.asList(name.split("\\.")); List<Object> values = new ArrayList<>(); if (!keys.isEmpty()) { final Object entry = source.get(keys.get(0)); if (entry == null) { readField(source.get(name), new ArrayList<>(), values); } else { readField(entry, keys.subList(1, keys.size()), values); } } final List<Object> result; if (!values.isEmpty()) { result = values; } else { result = null; } return result; } ElasticParserUtil(); @SuppressWarnings("unchecked") Geometry createGeometry(Object obj); @SuppressWarnings({"rawtypes", "unchecked"}) Geometry createGeometry(final Map<String, Object> properties); List<Object> readField(Map<String, Object> source, String name); @SuppressWarnings("rawtypes") static boolean isGeoPointFeature(Map<String, Object> map); static String urlDecode(String value);  }