martinzink commented on code in PR #1926:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1926#discussion_r1995256110
##########
extension-utils/src/utils/ProcessorConfigUtils.cpp:
##########
@@ -16,37 +16,93 @@
*/
#include "utils/ProcessorConfigUtils.h"
-#include <vector>
#include <string>
-#include <string_view>
-#include "range/v3/algorithm/contains.hpp"
-#include "utils/StringUtils.h"
+#include "utils/expected.h"
namespace org::apache::nifi::minifi::utils {
-std::vector<std::string> listFromCommaSeparatedProperty(const
core::ProcessContext& context, std::string_view property_name) {
- std::string property_string;
- context.getProperty(property_name, property_string);
- return utils::string::splitAndTrim(property_string, ",");
+std::string parseProperty(const core::ProcessContext& ctx, const
core::PropertyReference& property, const core::FlowFile* flow_file) {
+ return ctx.getProperty(property, flow_file) |
utils::expect(fmt::format("Expected valid value from {}::{}",
ctx.getProcessor().getName(), property.name));
}
-std::vector<std::string> listFromRequiredCommaSeparatedProperty(const
core::ProcessContext& context, std::string_view property_name) {
- return utils::string::splitAndTrim(getRequiredPropertyOrThrow(context,
property_name), ",");
+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;
Review Comment:
good idea,
https://github.com/apache/nifi-minifi-cpp/pull/1926/commits/d65654bad43b763cc2b1158b02a7c5ccc0bfb53c
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]