@SuppressWarnings("unchecked") private static Field[] collapseFields(Map<String, Object[]> fieldTable) { List<Field> fields = new ArrayList<Field>(); for (Map.Entry<String, Object[]> fieldInfo : fieldTable.entrySet()) { Field currentField = (Field)(fieldInfo.getValue()[0]); if (FieldType.isCompound(currentField.type())) { Map<String, Object[]> subTable = (Map<String, Object[]>)(fieldInfo.getValue()[1]); Field[] children = collapseFields(subTable); fields.add(new Field(currentField.name(), currentField.type(), children)); } else { fields.add(currentField); } } return fields.size() == 0 ? Field.NO_FIELDS : fields.toArray(new Field[fields.size()]); }
private static void addSubFieldToMap(Map<String, FieldType> fields, Field field, String parentName) { String fieldName = (parentName != null ? parentName + "." + field.name() : field.name()); fields.put(fieldName, field.type()); if (FieldType.isCompound(field.type())) { for (Field nestedField : field.properties()) { addSubFieldToMap(fields, nestedField, fieldName); } } }
private static void findGeo(Field field, String parentName, Map<String, GeoType> geoFields) { String fieldName = (parentName != null ? parentName + "." + field.name() : field.name()); if (FieldType.GEO_POINT == field.type()) { geoFields.put(fieldName, GeoType.GEO_POINT); } else if (FieldType.GEO_SHAPE == field.type()) { geoFields.put(fieldName, GeoType.GEO_SHAPE); } else if (FieldType.isCompound(field.type())) { for (Field nestedField : field.properties()) { findGeo(nestedField, fieldName, geoFields); } } }
private static boolean filterField(Field field, String parentName, List<Field> filtered, Collection<FieldFilter.NumberedInclude> includes, Collection<String> excludes) { String fieldName = (parentName != null ? parentName + "." + field.name() : field.name()); boolean intact = true; if (FieldFilter.filter(fieldName, includes, excludes).matched) { if (FieldType.isCompound(field.type())) { List<Field> nested = new ArrayList<Field>(); for (Field nestedField : field.properties()) { intact &= filterField(nestedField, fieldName, nested, includes, excludes); } filtered.add(new Field(field.name(), field.type(), nested)); } else { filtered.add(field); } } else { intact = false; } return intact; }
if (!FieldType.isCompound(fieldType)) { return new Field(key, fieldType);
if (entry == null) { if (FieldType.isCompound(field.type())) { if (FieldType.isCompound(field.type())) { Map<String, Object[]> subTable = (Map<String, Object[]>)entry[1]; String prefix = fullName + ".";
@SuppressWarnings("unchecked") private static Field[] collapseFields(Map<String, Object[]> fieldTable) { List<Field> fields = new ArrayList<Field>(); for (Map.Entry<String, Object[]> fieldInfo : fieldTable.entrySet()) { Field currentField = (Field)(fieldInfo.getValue()[0]); if (FieldType.isCompound(currentField.type())) { Map<String, Object[]> subTable = (Map<String, Object[]>)(fieldInfo.getValue()[1]); Field[] children = collapseFields(subTable); fields.add(new Field(currentField.name(), currentField.type(), children)); } else { fields.add(currentField); } } return fields.size() == 0 ? Field.NO_FIELDS : fields.toArray(new Field[fields.size()]); }
@SuppressWarnings("unchecked") private static Field[] collapseFields(Map<String, Object[]> fieldTable) { List<Field> fields = new ArrayList<Field>(); for (Map.Entry<String, Object[]> fieldInfo : fieldTable.entrySet()) { Field currentField = (Field)(fieldInfo.getValue()[0]); if (FieldType.isCompound(currentField.type())) { Map<String, Object[]> subTable = (Map<String, Object[]>)(fieldInfo.getValue()[1]); Field[] children = collapseFields(subTable); fields.add(new Field(currentField.name(), currentField.type(), children)); } else { fields.add(currentField); } } return fields.size() == 0 ? Field.NO_FIELDS : fields.toArray(new Field[fields.size()]); }
@SuppressWarnings("unchecked") private static Field[] collapseFields(Map<String, Object[]> fieldTable) { List<Field> fields = new ArrayList<Field>(); for (Map.Entry<String, Object[]> fieldInfo : fieldTable.entrySet()) { Field currentField = (Field)(fieldInfo.getValue()[0]); if (FieldType.isCompound(currentField.type())) { Map<String, Object[]> subTable = (Map<String, Object[]>)(fieldInfo.getValue()[1]); Field[] children = collapseFields(subTable); fields.add(new Field(currentField.name(), currentField.type(), children)); } else { fields.add(currentField); } } return fields.size() == 0 ? Field.NO_FIELDS : fields.toArray(new Field[fields.size()]); }
private static void findGeo(Field field, String parentName, Map<String, GeoType> geoFields) { String fieldName = (parentName != null ? parentName + "." + field.name() : field.name()); if (FieldType.GEO_POINT == field.type()) { geoFields.put(fieldName, GeoType.GEO_POINT); } else if (FieldType.GEO_SHAPE == field.type()) { geoFields.put(fieldName, GeoType.GEO_SHAPE); } else if (FieldType.isCompound(field.type())) { for (Field nestedField : field.properties()) { findGeo(nestedField, fieldName, geoFields); } } }
private static void addSubFieldToMap(Map<String, FieldType> fields, Field field, String parentName) { String fieldName = (parentName != null ? parentName + "." + field.name() : field.name()); fields.put(fieldName, field.type()); if (FieldType.isCompound(field.type())) { for (Field nestedField : field.properties()) { addSubFieldToMap(fields, nestedField, fieldName); } } }
private static void addSubFieldToMap(Map<String, FieldType> fields, Field field, String parentName) { String fieldName = (parentName != null ? parentName + "." + field.name() : field.name()); fields.put(fieldName, field.type()); if (FieldType.isCompound(field.type())) { for (Field nestedField : field.properties()) { addSubFieldToMap(fields, nestedField, fieldName); } } }
static void add(Map<String, FieldType> fields, Field field, String parentName) { String fieldName = (parentName != null ? parentName + "." + field.name() : field.name()); fields.put(fieldName, field.type()); if (FieldType.isCompound(field.type())) { for (Field nestedField : field.properties()) { add(fields, nestedField, fieldName); } } }
private static void addSubFieldToMap(Map<String, FieldType> fields, Field field, String parentName) { String fieldName = (parentName != null ? parentName + "." + field.name() : field.name()); fields.put(fieldName, field.type()); if (FieldType.isCompound(field.type())) { for (Field nestedField : field.properties()) { addSubFieldToMap(fields, nestedField, fieldName); } } }
private static void findGeo(Field field, String parentName, Map<String, GeoType> geoFields) { String fieldName = (parentName != null ? parentName + "." + field.name() : field.name()); if (FieldType.GEO_POINT == field.type()) { geoFields.put(fieldName, GeoType.GEO_POINT); } else if (FieldType.GEO_SHAPE == field.type()) { geoFields.put(fieldName, GeoType.GEO_SHAPE); } else if (FieldType.isCompound(field.type())) { for (Field nestedField : field.properties()) { findGeo(nestedField, fieldName, geoFields); } } }
private static void findGeo(Field field, String parentName, Map<String, GeoType> geoFields) { String fieldName = (parentName != null ? parentName + "." + field.name() : field.name()); if (FieldType.GEO_POINT == field.type()) { geoFields.put(fieldName, GeoType.GEO_POINT); } else if (FieldType.GEO_SHAPE == field.type()) { geoFields.put(fieldName, GeoType.GEO_SHAPE); } else if (FieldType.isCompound(field.type())) { for (Field nestedField : field.properties()) { findGeo(nestedField, fieldName, geoFields); } } }
private static void findGeo(Field field, String parentName, Map<String, GeoType> geoFields) { String fieldName = (parentName != null ? parentName + "." + field.name() : field.name()); if (FieldType.GEO_POINT == field.type()) { geoFields.put(fieldName, GeoType.GEO_POINT); } else if (FieldType.GEO_SHAPE == field.type()) { geoFields.put(fieldName, GeoType.GEO_SHAPE); } else if (FieldType.isCompound(field.type())) { for (Field nestedField : field.properties()) { findGeo(nestedField, fieldName, geoFields); } } }
private static boolean filterField(Field field, String parentName, List<Field> filtered, Collection<FieldFilter.NumberedInclude> includes, Collection<String> excludes) { String fieldName = (parentName != null ? parentName + "." + field.name() : field.name()); boolean intact = true; if (FieldFilter.filter(fieldName, includes, excludes).matched) { if (FieldType.isCompound(field.type())) { List<Field> nested = new ArrayList<Field>(); for (Field nestedField : field.properties()) { intact &= filterField(nestedField, fieldName, nested, includes, excludes); } filtered.add(new Field(field.name(), field.type(), nested)); } else { filtered.add(field); } } else { intact = false; } return intact; }
private static boolean filterField(Field field, String parentName, List<Field> filtered, Collection<FieldFilter.NumberedInclude> includes, Collection<String> excludes) { String fieldName = (parentName != null ? parentName + "." + field.name() : field.name()); boolean intact = true; if (FieldFilter.filter(fieldName, includes, excludes).matched) { if (FieldType.isCompound(field.type())) { List<Field> nested = new ArrayList<Field>(); for (Field nestedField : field.properties()) { intact &= filterField(nestedField, fieldName, nested, includes, excludes); } filtered.add(new Field(field.name(), field.type(), nested)); } else { filtered.add(field); } } else { intact = false; } return intact; }
private static boolean processField(Field field, String parentName, List<Field> filtered, Collection<NumberedInclude> includes, Collection<String> excludes) { String fieldName = (parentName != null ? parentName + "." + field.name() : field.name()); boolean intact = true; if (FieldFilter.filter(fieldName, includes, excludes).matched) { if (FieldType.isCompound(field.type())) { List<Field> nested = new ArrayList<Field>(); for (Field nestedField : field.properties()) { intact &= processField(nestedField, field.name(), nested, includes, excludes); } filtered.add(new Field(field.name(), field.type(), nested)); } else { filtered.add(field); } } else { intact = false; } return intact; }