This is an automated email from the ASF dual-hosted git repository.

martinzink pushed a commit to branch minifi-api-property
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit d65654bad43b763cc2b1158b02a7c5ccc0bfb53c
Author: Martin Zink <[email protected]>
AuthorDate: Wed Mar 12 13:01:58 2025 +0100

    simplify parseOptionalProperty
---
 extension-utils/src/utils/ProcessorConfigUtils.cpp | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/extension-utils/src/utils/ProcessorConfigUtils.cpp 
b/extension-utils/src/utils/ProcessorConfigUtils.cpp
index de13ee302..3bcf93e5c 100644
--- a/extension-utils/src/utils/ProcessorConfigUtils.cpp
+++ b/extension-utils/src/utils/ProcessorConfigUtils.cpp
@@ -27,10 +27,7 @@ std::string parseProperty(const core::ProcessContext& ctx, 
const core::PropertyR
 }
 
 std::optional<std::string> parseOptionalProperty(const core::ProcessContext& 
ctx, const core::PropertyReference& property, const core::FlowFile* flow_file) {
-  if (const auto property_str = ctx.getProperty(property, flow_file)) {
-    return *property_str;
-  }
-  return std::nullopt;
+  return ctx.getProperty(property, flow_file) | utils::toOptional();
 }
 
 std::optional<bool> parseOptionalBoolProperty(const core::ProcessContext& ctx, 
const core::PropertyReference& property, const core::FlowFile* flow_file) {

Reply via email to