public static FieldPath buildFieldPath(String remainFieldName, DataType keyType, DataType valueType) { if (remainFieldName.length() > 0 && remainFieldName.charAt(0) == '{') { FieldPathEntry.KeyParseResult result = FieldPathEntry.parseKey(remainFieldName); String keyValue = result.parsed; FieldPath path = valueType.buildFieldPath(skipDotInString(remainFieldName, result.consumedChars - 1)); List<FieldPathEntry> tmpPath = new ArrayList<FieldPathEntry>(path.getList()); if (remainFieldName.charAt(1) == '$') { tmpPath.add(0, FieldPathEntry.newVariableLookupEntry(keyValue.substring(1), valueType)); } else { FieldValue fv = keyType.createFieldValue(); fv.assign(keyValue); tmpPath.add(0, FieldPathEntry.newMapLookupEntry(fv, valueType)); } return new FieldPath(tmpPath); } else if (remainFieldName.startsWith("key")) { FieldPath path = keyType.buildFieldPath(skipDotInString(remainFieldName, 2)); List<FieldPathEntry> tmpPath = new ArrayList<FieldPathEntry>(path.getList()); tmpPath.add(0, FieldPathEntry.newAllKeysLookupEntry(keyType)); return new FieldPath(tmpPath); } else if (remainFieldName.startsWith("value")) { FieldPath path = valueType.buildFieldPath(skipDotInString(remainFieldName, 4)); List<FieldPathEntry> tmpPath = new ArrayList<FieldPathEntry>(path.getList()); tmpPath.add(0, FieldPathEntry.newAllValuesLookupEntry(valueType)); return new FieldPath(tmpPath); } return keyType.buildFieldPath(remainFieldName); }