szaszm commented on code in PR #1626:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1626#discussion_r1293381914


##########
libminifi/include/core/PropertyDefinitionBuilder.h:
##########
@@ -23,75 +23,69 @@
 
 namespace org::apache::nifi::minifi::core {
 
-template <size_t NumAllowedValues = 0, size_t NumAllowedTypes = 0, size_t 
NumDependentProperties = 0, size_t NumExclusiveOfProperties = 0>
+template<size_t NumAllowedValues = 0, size_t NumDependentProperties = 0, 
size_t NumExclusiveOfProperties = 0, typename AllowedTypes = 
utils::meta::type_list<>>
 struct PropertyDefinitionBuilder {
-  static constexpr PropertyDefinitionBuilder<NumAllowedValues, 
NumAllowedTypes, NumDependentProperties, NumExclusiveOfProperties> 
createProperty(std::string_view name) {
-    PropertyDefinitionBuilder<NumAllowedValues, NumAllowedTypes, 
NumDependentProperties, NumExclusiveOfProperties> builder;
+  static constexpr PropertyDefinitionBuilder<NumAllowedValues, 
NumDependentProperties, NumExclusiveOfProperties, AllowedTypes> 
createProperty(std::string_view name) {
+    PropertyDefinitionBuilder<NumAllowedValues, NumDependentProperties, 
NumExclusiveOfProperties, AllowedTypes> builder;
     builder.property.name = name;
     return builder;
   }
 
-  static constexpr PropertyDefinitionBuilder<NumAllowedValues, 
NumAllowedTypes, NumDependentProperties, NumExclusiveOfProperties> 
createProperty(std::string_view name, std::string_view display_name) {
-    PropertyDefinitionBuilder<NumAllowedValues, NumAllowedTypes, 
NumDependentProperties, NumExclusiveOfProperties> builder;
+  static constexpr PropertyDefinitionBuilder<NumAllowedValues, 
NumDependentProperties, NumExclusiveOfProperties, AllowedTypes> 
createProperty(std::string_view name, std::string_view display_name) {
+    PropertyDefinitionBuilder<NumAllowedValues, NumDependentProperties, 
NumExclusiveOfProperties, AllowedTypes> builder;
     builder.property.name = name;
     builder.property.display_name = display_name;
     return builder;
   }
 
-  constexpr PropertyDefinitionBuilder<NumAllowedValues, NumAllowedTypes, 
NumDependentProperties, NumExclusiveOfProperties> 
withDescription(std::string_view description) {
+  constexpr PropertyDefinitionBuilder<NumAllowedValues, 
NumDependentProperties, NumExclusiveOfProperties, AllowedTypes> 
withDescription(std::string_view description) {
     property.description = description;
     return *this;
   }
 
-  constexpr PropertyDefinitionBuilder<NumAllowedValues, NumAllowedTypes, 
NumDependentProperties, NumExclusiveOfProperties> isRequired(bool required) {
+  constexpr PropertyDefinitionBuilder<NumAllowedValues, 
NumDependentProperties, NumExclusiveOfProperties, AllowedTypes> isRequired(bool 
required) {
     property.is_required = required;
     return *this;
   }
 
-  constexpr PropertyDefinitionBuilder<NumAllowedValues, NumAllowedTypes, 
NumDependentProperties, NumExclusiveOfProperties> 
supportsExpressionLanguage(bool supports_expression_language) {
+  constexpr PropertyDefinitionBuilder<NumAllowedValues, 
NumDependentProperties, NumExclusiveOfProperties, AllowedTypes> 
supportsExpressionLanguage(bool supports_expression_language) {
     property.supports_expression_language = supports_expression_language;
     return *this;
   }
 
-  constexpr PropertyDefinitionBuilder<NumAllowedValues, NumAllowedTypes, 
NumDependentProperties, NumExclusiveOfProperties> 
withDefaultValue(std::string_view default_value) {
+  constexpr PropertyDefinitionBuilder<NumAllowedValues, 
NumDependentProperties, NumExclusiveOfProperties, AllowedTypes> 
withDefaultValue(std::string_view default_value) {
     property.default_value = std::optional<std::string_view>{default_value};  
// workaround for gcc 11.1; on gcc 11.3 and later, `property.default_value = 
default_value` works, too
     return *this;
   }
 
-  constexpr PropertyDefinitionBuilder<NumAllowedValues, NumAllowedTypes, 
NumDependentProperties, NumExclusiveOfProperties> withAllowedValues(
+  constexpr PropertyDefinitionBuilder<NumAllowedValues, 
NumDependentProperties, NumExclusiveOfProperties, AllowedTypes> 
withAllowedValues(
       std::array<std::string_view, NumAllowedValues> allowed_values) {
     property.allowed_values = allowed_values;
     return *this;
   }
 
-  constexpr PropertyDefinitionBuilder<NumAllowedValues, NumAllowedTypes, 
NumDependentProperties, NumExclusiveOfProperties> withAllowedTypes(
-      std::array<std::string_view, NumAllowedTypes> types) {
-    property.allowed_types = types;
-    return *this;
-  }

Review Comment:
   that's a great solution that I completely missed when writing the comment. 
Thanks!



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