exceptionfactory commented on code in PR #5977:
URL: https://github.com/apache/nifi/pull/5977#discussion_r859793743


##########
nifi-api/src/main/java/org/apache/nifi/components/PropertyDescriptor.java:
##########
@@ -396,6 +396,20 @@ public <E extends Enum<E>> Builder allowableValues(final 
E[] values) {
             return this;
         }
 
+        /**
+         * Stores allowable values from an enum class.
+         * @param enumClass an enum class that implements the Allowable 
interface and contains a set of values
+         * @param <E> generic parameter for an enum class that implements the 
Allowable interface
+         * @return the builder
+         */
+        public <E extends Enum<E> & DescribedValue> Builder 
allowableValues(final Class<E> enumClass) {
+            this.allowableValues = new ArrayList<>();
+            for (E enumValue : enumClass.getEnumConstants()) {
+                this.allowableValues.add(new AllowableValue(enumValue.name(), 
enumValue.getDisplayName(), enumValue.getDescription()));

Review Comment:
   Following the interface adjustments, `enumValue.name()` should be replaced 
with `enumValue.getValue()`:
   
   ```suggestion
                   this.allowableValues.add(new 
AllowableValue(enumValue.getValue(), enumValue.getDisplayName(), 
enumValue.getDescription()));
   ```



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