You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2025/03/14 09:28:28 UTC

(nifi-minifi-cpp) 07/15: simplify parseOptionalProperty

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 <ma...@apache.org>
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) {