@Test public void testKeyAsColumnMapping() { checkParser(new ColumnMapping.Builder() .keyAsColumn("s", "f") .build(), "[ {\"source\": \"s\", \"type\": \"keyAsColumn\", \"value\": \"f\"} ]"); checkParser(new ColumnMapping.Builder() .keyAsColumn("s", "f", "p") .build(), "[ {\"source\": \"s\", \"type\": \"keyAsColumn\"," + "\"value\": \"f:p\"} ]"); checkParser(new ColumnMapping.Builder() .keyAsColumn("s", "f") .build(), "[ {\"source\": \"s\", \"type\": \"keyAsColumn\"," + "\"family\": \"f\" } ]"); checkParser(new ColumnMapping.Builder() .keyAsColumn("s", "f", "p") .build(), "[ {\"source\": \"s\", \"type\": \"keyAsColumn\"," + "\"family\": \"f\", \"prefix\": \"p\" } ]"); checkParser(new ColumnMapping.Builder() .keyAsColumn("s", "fam") .build(), "[ {\"source\": \"s\", \"type\": \"keyAsColumn\", \"value\": \"f\", " + "\"family\": \"fam\"} ]"); checkParser(new ColumnMapping.Builder() .keyAsColumn("s", "fam", "pre") .build(), "[ {\"source\": \"s\", \"type\": \"keyAsColumn\"," + "\"value\": \"f:p\", \"family\": \"fam\", \"prefix\": \"pre\"} ]"); TestHelpers.assertThrows("Should reject missing source", ValidationException.class, new Runnable() { @Override public void run() { ColumnMappingParser.parse("[ {\"type\": \"keyAsColumn\", \"family\": \"f\"} ]"); } } ); TestHelpers.assertThrows("Should reject missing family", ValidationException.class, new Runnable() { @Override public void run() { ColumnMappingParser.parse("[ {\"source\": \"s\", \"type\": \"keyAsColumn\"} ]"); } } ); TestHelpers.assertThrows("Should reject empty family", ValidationException.class, new Runnable() { @Override public void run() { ColumnMappingParser.parse("[ {\"source\": \"s\", \"type\": \"keyAsColumn\"" + "\"value\": \"\"} ]"); } } ); TestHelpers.assertThrows("Should reject empty family", ValidationException.class, new Runnable() { @Override public void run() { ColumnMappingParser.parse("[ {\"source\": \"s\", \"type\": \"keyAsColumn\"" + "\"family\": \"\"} ]"); } } ); TestHelpers.assertThrows("Should reject empty family", ValidationException.class, new Runnable() { @Override public void run() { ColumnMappingParser.parse("[ {\"source\": \"s\", \"type\": \"keyAsColumn\"" + "\"value\": \":\"} ]"); } } ); TestHelpers.assertThrows("Should reject qualifier", ValidationException.class, new Runnable() { @Override public void run() { ColumnMappingParser.parse("[ {\"source\": \"s\", \"type\": \"keyAsColumn\"," + "\"family\": \"f\", \"qualifier\": \"\"} ]"); } } ); }
public static ColumnMapping parse(String mappingDescriptor) { return buildColumnMapping(JsonUtil.parse(mappingDescriptor)); }
ColumnMappingParser { public static ColumnMapping parse(String mappingDescriptor) { return buildColumnMapping(JsonUtil.parse(mappingDescriptor)); } }
ColumnMappingParser { public static ColumnMapping parse(String mappingDescriptor) { return buildColumnMapping(JsonUtil.parse(mappingDescriptor)); }  }
ColumnMappingParser { public static ColumnMapping parse(String mappingDescriptor) { return buildColumnMapping(JsonUtil.parse(mappingDescriptor)); }  static ColumnMapping parse(String mappingDescriptor); static ColumnMapping parse(File file); static ColumnMapping parse(InputStream in); static boolean hasEmbeddedColumnMapping(Schema schema); static Schema removeEmbeddedMapping(Schema schema); static ColumnMapping parseFromSchema(Schema schema); static boolean hasEmbeddedFieldMappings(Schema schema); static ColumnMapping parseFromSchemaFields(Schema schema); static Schema embedColumnMapping(Schema schema, ColumnMapping mapping); static Map<Integer, FieldMapping> parseKeyMappingsFromSchemaFields(
      Schema schema); static FieldMapping parseFieldMapping(JsonNode mappingNode); static FieldMapping parseFieldMapping(String source, JsonNode mappingNode); static String toString(FieldMapping mapping); static String toString(ColumnMapping mapping, boolean pretty); }
ColumnMappingParser { public static ColumnMapping parse(String mappingDescriptor) { return buildColumnMapping(JsonUtil.parse(mappingDescriptor)); }  static ColumnMapping parse(String mappingDescriptor); static ColumnMapping parse(File file); static ColumnMapping parse(InputStream in); static boolean hasEmbeddedColumnMapping(Schema schema); static Schema removeEmbeddedMapping(Schema schema); static ColumnMapping parseFromSchema(Schema schema); static boolean hasEmbeddedFieldMappings(Schema schema); static ColumnMapping parseFromSchemaFields(Schema schema); static Schema embedColumnMapping(Schema schema, ColumnMapping mapping); static Map<Integer, FieldMapping> parseKeyMappingsFromSchemaFields(
      Schema schema); static FieldMapping parseFieldMapping(JsonNode mappingNode); static FieldMapping parseFieldMapping(String source, JsonNode mappingNode); static String toString(FieldMapping mapping); static String toString(ColumnMapping mapping, boolean pretty);  }