com.hurence.logisland.record.Record.removeField()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(72)

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

Record.removeField介绍

暂无

代码示例

代码示例来源:origin: com.hurence.logisland/logisland-common-processors-plugin

private void extractAndParsePropertiesField(Record outputRecord, String propertiesField) {
  Field field = outputRecord.getField(propertiesField);
  if (field != null) {
    String str = field.getRawValue().toString();
    Matcher matcher = PROPERTIES_SPLITTER_PATTERN.matcher(str);
    while (matcher.find()) {
      if (matcher.groupCount() == 2) {
        String key = matcher.group(1);
        String value = matcher.group(2).trim();
        // logger.debug(String.format("field %s = %s", key, value));
        outputRecord.setField(key, FieldType.STRING, value);
      }
    }
    outputRecord.removeField("properties");
  }
}

代码示例来源:origin: com.hurence.logisland/logisland-common-processors-plugin

@Override
public Collection<Record> process(ProcessContext context, Collection<Record> records) {
  try {
    List<String> fieldsToRemove = Lists.newArrayList(
        context.getPropertyValue(FIELDS_TO_REMOVE).asString().split(","));
    for (Record record : records) {
      new ArrayList<>(record.getAllFields()).forEach(field -> {
        String fieldName = field.getName();
        if (fieldsToRemove.contains(fieldName)) {
          record.removeField(fieldName);
        }
      });
    }
  } catch (Exception ex) {
    logger.warn("issue while trying to remove field list {} :  {}",
        context.getPropertyValue(FIELDS_TO_REMOVE).asString(),
        ex.toString());
  }
  return records;
}

代码示例来源:origin: com.hurence.logisland/logisland-common-processors-plugin

private void overwriteObsoleteFieldValue(Record record, String fieldName, String newValue) {
  final Field fieldToUpdate = record.getField(fieldName);
  record.removeField(fieldName);
  record.setField(fieldName, fieldToUpdate.getType(), newValue);
}

代码示例来源:origin: com.hurence.logisland/logisland-common-processors-plugin

@Override
public Collection<Record> process(ProcessContext context, Collection<Record> records) {
  List<Record> outputRecords = (List<Record>) super.process(context, records);
  String propertiesField = context.getPropertyValue(PROPERTIES_FIELD).asString();
  for (Record outputRecord : outputRecords) {
    Field field = outputRecord.getField(propertiesField);
    if (field != null) {
      String str = field.getRawValue().toString();
      Matcher matcher = PROPERTIES_SPLITTER_PATTERN.matcher(str);
      while (matcher.find()) {
        if (matcher.groupCount() == 2) {
          String key = matcher.group(1);
          String value = matcher.group(2);
          // logger.debug(String.format("field %s = %s", key, value));
          outputRecord.setField(key, FieldType.STRING, value);
        }
      }
      outputRecord.removeField("properties");
    }
  }
  return outputRecords;
}

代码示例来源:origin: com.hurence.logisland/logisland-common-processors-plugin

private void overwriteObsoleteFieldName(Record record, String normalizedFieldName, String obsoleteFieldName) {
  // remove old badly named field
  if (record.hasField(obsoleteFieldName)) {
    final Field fieldToRename = record.getField(obsoleteFieldName);
    record.removeField(obsoleteFieldName);
    record.setField(normalizedFieldName, fieldToRename.getType(), fieldToRename.getRawValue());
  }
}

代码示例来源:origin: com.hurence.logisland/logisland-cyber-security-plugin

} else
  record.removeField(FieldDictionary.RECORD_KEY);
  record.removeField(FieldDictionary.RECORD_VALUE);

代码示例来源:origin: com.hurence.logisland/logisland-common-processors-plugin

for (String obsoleteFieldName : obsoleteFieldNames) {
  if (record.hasField(obsoleteFieldName)) {
    record.removeField(obsoleteFieldName);

代码示例来源:origin: com.hurence.logisland/logisland-useragent-plugin

record.removeField(userAgentField);

相关文章