lordgamez commented on a change in pull request #1052:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1052#discussion_r618406371



##########
File path: libminifi/include/utils/ProcessorConfigUtils.h
##########
@@ -19,59 +19,23 @@
 
 #include <vector>
 #include <string>
+#include <set>
 
-#include "utils/StringUtils.h"
+#include "core/ProcessContext.h"
 
 namespace org {
 namespace apache {
 namespace nifi {
 namespace minifi {
 namespace utils {
 
-std::string getRequiredPropertyOrThrow(const core::ProcessContext* context, 
const std::string& property_name) {
-  std::string value;
-  if (!context->getProperty(property_name, value)) {
-    throw std::runtime_error(property_name + " property missing or invalid");
-  }
-  return value;
-}
-
-std::vector<std::string> listFromCommaSeparatedProperty(const 
core::ProcessContext* context, const std::string& property_name) {
-  std::string property_string;
-  context->getProperty(property_name, property_string);
-  return utils::StringUtils::splitAndTrim(property_string, ",");
-}
-
-std::vector<std::string> listFromRequiredCommaSeparatedProperty(const 
core::ProcessContext* context, const std::string& property_name) {
-  return utils::StringUtils::splitAndTrim(getRequiredPropertyOrThrow(context, 
property_name), ",");
-}
-
-bool parseBooleanPropertyOrThrow(core::ProcessContext* context, const 
std::string& property_name) {
-  const std::string value_str = getRequiredPropertyOrThrow(context, 
property_name);
-  utils::optional<bool> maybe_value = utils::StringUtils::toBool(value_str);
-  if (!maybe_value) {
-    throw std::runtime_error(property_name + " property is invalid: value is " 
+ value_str);
-  }
-  return maybe_value.value();
-}
-
-std::chrono::milliseconds parseTimePropertyMSOrThrow(core::ProcessContext* 
context, const std::string& property_name) {
-  core::TimeUnit unit;
-  uint64_t time_value_ms;
-  const std::string value_str = getRequiredPropertyOrThrow(context, 
property_name);
-  if (!core::Property::StringToTime(value_str, time_value_ms, unit) || 
!core::Property::ConvertTimeUnitToMS(time_value_ms, unit, time_value_ms)) {
-    throw std::runtime_error(property_name + " property is invalid: value is " 
+ value_str);
-  }
-  return std::chrono::milliseconds(time_value_ms);
-}
-
-utils::optional<uint64_t> getOptionalUintProperty(const core::ProcessContext& 
context, const std::string& property_name) {
-  uint64_t value;
-  if (context.getProperty(property_name, value)) {
-    return { value };
-  }
-  return utils::nullopt;
-}
+std::string getRequiredPropertyOrThrow(const core::ProcessContext* context, 
const std::string& property_name);

Review comment:
       It looks like it, maybe @hunyadi-dev can comment on it as it was 
introduced in #940. Are there any differences in the behavior of getProperty 
and getRequiredPropertyOrThrow?




-- 
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to