fgerlits commented on code in PR #1589:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1589#discussion_r1265627207


##########
libminifi/include/core/ProcessContext.h:
##########
@@ -102,18 +103,44 @@ class ProcessContext : public 
controller::ControllerServiceLookup, public core::
     return value;
   }
 
+  template<typename T = std::string>
+  std::enable_if_t<std::is_default_constructible<T>::value, std::optional<T>>
+  getProperty(const PropertyReference& property) const {
+    T value;
+    try {
+      if (!getProperty(property.name, value)) return std::nullopt;
+    } catch (const utils::internal::ValueException&) {
+      return std::nullopt;
+    }
+    return value;
+  }
+
+  template<typename T>
+  requires(!std::is_convertible_v<T&, const FlowFile&> && 
!std::is_convertible_v<T&, const std::shared_ptr<FlowFile>&>)
+  bool getProperty(std::string_view name, T &value) const {
+    return getPropertyImp<typename 
std::common_type<T>::type>(std::string{name}, value);
+  }
+
   template<typename T>
-  std::enable_if_t<!std::is_convertible_v<T&, const FlowFile&> && 
!std::is_convertible_v<T&, const std::shared_ptr<FlowFile>&>,
-      bool> getProperty(const std::string &name, T &value) const {
-    return getPropertyImp<typename std::common_type<T>::type>(name, value);
+  requires(!std::is_convertible_v<T&, const FlowFile&> && 
!std::is_convertible_v<T&, const std::shared_ptr<FlowFile>&>)
+  bool getProperty(const PropertyReference& property, T &value) const {

Review Comment:
   done in 1f8b8afb8ec970de037384b8af85081fcd370bd1



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

Reply via email to