@Test public void testGetMultiValue() throws IOException { setAccessorToRecordWithArrays(); Map<String, String> fields = accessor.getMultiAsString("nestedRecords.*.fieldToEncrypt"); Assert.assertEquals(fields.size(), 3); Assert.assertEquals(fields.get("nestedRecords.0.fieldToEncrypt"), "val0"); Assert.assertEquals(fields.get("nestedRecords.1.fieldToEncrypt"), "val1"); Assert.assertEquals(fields.get("nestedRecords.2.fieldToEncrypt"), "val2"); }
@Override public Map<String, String> getMultiAsString(String fieldName) { Map<String, Object> vals = getMultiGeneric(fieldName); Map<String, String> ret = new HashMap<>(); for (Map.Entry<String, Object> entry : vals.entrySet()) { Object val = entry.getValue(); String convertedVal = convertToString(entry.getKey(), val); if (convertedVal != null) { ret.put(entry.getKey(), convertedVal); } } return ret; }
AvroGenericRecordAccessor implements RecordAccessor { @Override public Map<String, String> getMultiAsString(String fieldName) { Map<String, Object> vals = getMultiGeneric(fieldName); Map<String, String> ret = new HashMap<>(); for (Map.Entry<String, Object> entry : vals.entrySet()) { Object val = entry.getValue(); String convertedVal = convertToString(entry.getKey(), val); if (convertedVal != null) { ret.put(entry.getKey(), convertedVal); } } return ret; } }
AvroGenericRecordAccessor implements RecordAccessor { @Override public Map<String, String> getMultiAsString(String fieldName) { Map<String, Object> vals = getMultiGeneric(fieldName); Map<String, String> ret = new HashMap<>(); for (Map.Entry<String, Object> entry : vals.entrySet()) { Object val = entry.getValue(); String convertedVal = convertToString(entry.getKey(), val); if (convertedVal != null) { ret.put(entry.getKey(), convertedVal); } } return ret; } AvroGenericRecordAccessor(GenericRecord record); }
AvroGenericRecordAccessor implements RecordAccessor { @Override public Map<String, String> getMultiAsString(String fieldName) { Map<String, Object> vals = getMultiGeneric(fieldName); Map<String, String> ret = new HashMap<>(); for (Map.Entry<String, Object> entry : vals.entrySet()) { Object val = entry.getValue(); String convertedVal = convertToString(entry.getKey(), val); if (convertedVal != null) { ret.put(entry.getKey(), convertedVal); } } return ret; } AvroGenericRecordAccessor(GenericRecord record); @Override Map<String, String> getMultiAsString(String fieldName); @Override String getAsString(String fieldName); @Override Map<String, Integer> getMultiAsInt(String fieldName); @Override Integer getAsInt(String fieldName); @Override Map<String, Long> getMultiAsLong(String fieldName); @Override Long getAsLong(String fieldName); @Override Map<String, Object> getMultiGeneric(String fieldName); @Override Object getGeneric(String fieldName); @Override void set(String fieldName, String value); @Override void set(String fieldName, Integer value); @Override void set(String fieldName, Long value); @Override void setStringArray(String fieldName, List<String> value); @Override void setToNull(String fieldName); }
AvroGenericRecordAccessor implements RecordAccessor { @Override public Map<String, String> getMultiAsString(String fieldName) { Map<String, Object> vals = getMultiGeneric(fieldName); Map<String, String> ret = new HashMap<>(); for (Map.Entry<String, Object> entry : vals.entrySet()) { Object val = entry.getValue(); String convertedVal = convertToString(entry.getKey(), val); if (convertedVal != null) { ret.put(entry.getKey(), convertedVal); } } return ret; } AvroGenericRecordAccessor(GenericRecord record); @Override Map<String, String> getMultiAsString(String fieldName); @Override String getAsString(String fieldName); @Override Map<String, Integer> getMultiAsInt(String fieldName); @Override Integer getAsInt(String fieldName); @Override Map<String, Long> getMultiAsLong(String fieldName); @Override Long getAsLong(String fieldName); @Override Map<String, Object> getMultiGeneric(String fieldName); @Override Object getGeneric(String fieldName); @Override void set(String fieldName, String value); @Override void set(String fieldName, Integer value); @Override void set(String fieldName, Long value); @Override void setStringArray(String fieldName, List<String> value); @Override void setToNull(String fieldName);  }