@Test public void testGetMultiConvertsStrings() throws IOException { updateRecordFromTestResource("converter/fieldPickInput", "converter/fieldPickInput_arrays.avro"); Map<String, Object> ret = accessor.getMultiGeneric("favorite_quotes"); Object val = ret.get("favorite_quotes"); Assert.assertTrue(val instanceof List); List castedVal = (List)val; Assert.assertEquals(2, castedVal.size()); Assert.assertEquals("hello world", castedVal.get(0)); Assert.assertEquals("foobar", castedVal.get(1)); }
@Override public Map<String, Object> getMultiGeneric(String fieldName) { Map<String, Object> vals = AvroUtils.getMultiFieldValue(record, fieldName); for (Map.Entry<String, Object> entry: vals.entrySet()) { vals.put(entry.getKey(), convertAvroToJava(entry.getKey(), entry.getValue())); } return vals; }
AvroGenericRecordAccessor implements RecordAccessor { @Override public Map<String, Object> getMultiGeneric(String fieldName) { Map<String, Object> vals = AvroUtils.getMultiFieldValue(record, fieldName); for (Map.Entry<String, Object> entry: vals.entrySet()) { vals.put(entry.getKey(), convertAvroToJava(entry.getKey(), entry.getValue())); } return vals; } }
AvroGenericRecordAccessor implements RecordAccessor { @Override public Map<String, Object> getMultiGeneric(String fieldName) { Map<String, Object> vals = AvroUtils.getMultiFieldValue(record, fieldName); for (Map.Entry<String, Object> entry: vals.entrySet()) { vals.put(entry.getKey(), convertAvroToJava(entry.getKey(), entry.getValue())); } return vals; } AvroGenericRecordAccessor(GenericRecord record); }
AvroGenericRecordAccessor implements RecordAccessor { @Override public Map<String, Object> getMultiGeneric(String fieldName) { Map<String, Object> vals = AvroUtils.getMultiFieldValue(record, fieldName); for (Map.Entry<String, Object> entry: vals.entrySet()) { vals.put(entry.getKey(), convertAvroToJava(entry.getKey(), entry.getValue())); } return vals; } 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, Object> getMultiGeneric(String fieldName) { Map<String, Object> vals = AvroUtils.getMultiFieldValue(record, fieldName); for (Map.Entry<String, Object> entry: vals.entrySet()) { vals.put(entry.getKey(), convertAvroToJava(entry.getKey(), entry.getValue())); } return vals; } 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);  }