/** visit a value */ private void visitValue(final Object value) { if (value instanceof Map) { // if it's a location, then create a location field. if (EntityMap.isLocationField((Map) value)) { Map<String, Object> map = (Map) value; Map<String, Object> location = new HashMap<>(2); // normalize location field to use lat/lon for es location.put("lat", map.get("latitude")); location.put("lon", map.get("longitude")); fields.add(EntityField.create(fieldStack.peek(), location)); return; } iterate((Map<String, ?>) value); } // TODO figure out our nested array structure else if (value instanceof Collection) { iterate((Collection) value); } else { visitPrimitive(value); } }
private void visit(final float value) { fields.add(EntityField.create(fieldStack.peek(), value)); }
/** Visit al the primitive values */ private void visit(final String value) { fields.add(EntityField.create(fieldStack.peek(), value.toLowerCase())); }