com.hurence.logisland.component.PropertyValue.evaluate()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(158)

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

PropertyValue.evaluate介绍

[英]In the case of PropertyDescriptors that do support expression language, the fill method allows to obtain a PropertyValue that is filled in with record content.
[中]对于支持表达式语言的PropertyDescriptor,fill方法允许获取用记录内容填充的PropertyValue。

代码示例

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

private void updateRecord(ProcessContext context, Record record, Map<String, String> fieldsNameMapping) {
  String conflictPolicy = context.getPropertyValue(CONFLICT_RESOLUTION_POLICY).asString();
  if ((fieldsNameMapping == null) || (fieldsNameMapping.keySet() == null)) {
    return;
  }
  fieldsNameMapping.keySet().forEach(addedFieldName -> {
    final String defaultValueToAdd = context.getPropertyValue(addedFieldName).evaluate(record).asString();
    // field is already here
    if (record.hasField(addedFieldName)) {
      if (conflictPolicy.equals(OVERWRITE_EXISTING.getValue())) {
        overwriteObsoleteFieldValue(record, addedFieldName, defaultValueToAdd);
      }
    } else {
      record.setStringField(addedFieldName, defaultValueToAdd);
    }
  });
}

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

recordKeyName = context.getPropertyValue(RECORD_KEY_FIELD).evaluate(record).asString();
  indexName = context.getPropertyValue(ES_INDEX_FIELD).evaluate(record).asString();
  typeName = context.getPropertyValue(ES_TYPE_FIELD).evaluate(record).asString();
  includesFieldName = context.getPropertyValue(ES_INCLUDES_FIELD).evaluate(record).asString();
} catch (Throwable t) {
  record.setStringField(FieldDictionary.RECORD_ERRORS, "Failure in executing EL. Error: " + t.getMessage());

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

recordKeyName = context.getPropertyValue(RECORD_KEY_FIELD).evaluate(record).asString();
  indexName = context.getPropertyValue(COLLECTION_NAME).evaluate(record).asString();
  if (context.getPropertyValue(TYPE_NAME).isSet())
    typeName = context.getPropertyValue(TYPE_NAME).evaluate(record).asString();
  includesFieldName = context.getPropertyValue(INCLUDES_FIELD).evaluate(record).asString();
} catch (Throwable t) {
  record.setStringField(FieldDictionary.RECORD_ERRORS, "Failure in executing EL. Error: " + t.getMessage());

相关文章