[ https://issues.apache.org/jira/browse/NIFI-12452?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
David Handermann resolved NIFI-12452. ------------------------------------- Fix Version/s: 2.0.0 Resolution: Fixed > Improve support for Enum & DescribedValue for allowableValues > ------------------------------------------------------------- > > Key: NIFI-12452 > URL: https://issues.apache.org/jira/browse/NIFI-12452 > Project: Apache NiFi > Issue Type: Improvement > Components: Core Framework > Reporter: endzeit > Priority: Major > Fix For: 2.0.0 > > Time Spent: 2h 20m > Remaining Estimate: 0h > > The {{PropertyDescriptor.Builder}} supports providing a {{Class}} that is > both an {{Enum}} and {{{}DescribedValue{}}}. This improves type safety, by > avoiding the passing of sheer arbitrary {{String}} values. > I'd like to propose extensions to both the {{PropertyDescriptor.Builder}} > class as well as the {{PropertyValue}} interface. > ---- > The {{PropertyDescriptor.Builder}} should allow not only a raw {{String}} to > be provided as {{{}defaultValue(){}}}, but also provide an overload that > instead accepts an {{{}DescribedValue{}}}. > {code:java} > public Builder defaultValue(final DescribedValue value) {code} > This allows to replace > {code:java} > .allowableValues(Foo.class) > .defaultValue(Foo.BAR.getValue()) {code} > with > {code:java} > .allowableValues(Foo.class) > .defaultValue(Foo.BAR) {code} > ---- > The {{PropertyValue}} should allow to receive the value as one of the Enum > constants, similar to one of the existing {{as...}} methods. > {code:java} > <E extends Enum<E> & DescribedValue> E asAllowableValue(Class<E> clazz) {code} > This way processor implementations rely on type-safe mappings of allowable > values instead of matching on {{String}} values manually. -- This message was sent by Atlassian Jira (v8.20.10#820010)