Lehel44 commented on code in PR #5977:
URL: https://github.com/apache/nifi/pull/5977#discussion_r860100082
##########
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:
Oh wow, 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]