org.apache.gobblin.util.AvroUtils.getMultiFieldValue()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中org.apache.gobblin.util.AvroUtils.getMultiFieldValue()方法的一些代码示例,展示了AvroUtils.getMultiFieldValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AvroUtils.getMultiFieldValue()方法的具体详情如下:
包路径:org.apache.gobblin.util.AvroUtils
类名称:AvroUtils
方法名:getMultiFieldValue

AvroUtils.getMultiFieldValue介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-gobblin

/**
 * Given a GenericRecord, this method will return the field specified by the path parameter. The fieldLocation
 * parameter is an ordered string specifying the location of the nested field to retrieve. For example,
 * field1.nestedField1 takes the the value of the field "field1", and retrieves the field "nestedField1" from it.
 * @param record is the record to retrieve the field from
 * @param fieldLocation is the location of the field
 * @return the value of the field
 */
public static Optional<Object> getFieldValue(GenericRecord record, String fieldLocation) {
 Map<String, Object> ret = getMultiFieldValue(record, fieldLocation);
 return Optional.fromNullable(ret.get(fieldLocation));
}

代码示例来源:origin: apache/incubator-gobblin

@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;
}

代码示例来源:origin: org.apache.gobblin/gobblin-utility

/**
 * Given a GenericRecord, this method will return the field specified by the path parameter. The fieldLocation
 * parameter is an ordered string specifying the location of the nested field to retrieve. For example,
 * field1.nestedField1 takes the the value of the field "field1", and retrieves the field "nestedField1" from it.
 * @param record is the record to retrieve the field from
 * @param fieldLocation is the location of the field
 * @return the value of the field
 */
public static Optional<Object> getFieldValue(GenericRecord record, String fieldLocation) {
 Map<String, Object> ret = getMultiFieldValue(record, fieldLocation);
 return Optional.fromNullable(ret.get(fieldLocation));
}

代码示例来源:origin: org.apache.gobblin/gobblin-core

@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;
}

相关文章