Hello

I think the spirit of the ask is great.  We should continue to monitor for
such commonalities and consider if we promote such a thing to our API level
standard interface.

However, in reviewing the usage of seeking Charset info vs the other more
fundamental primitive types it does not seem to warrant it at this point in
terms of how commonly needed it is and/or the couple lines of code it takes
to handle.

Thanks

On Thu, Jan 9, 2025 at 7:48 AM David Handermann <exceptionfact...@apache.org>
wrote:

> Dan,
>
> Thanks for raising this question for discussion. Although it is
> convenient, it does not seem common enough to warrant the addition, on
> initial consideration. Although there are a number of convenience
> methods in PropertyValue for common types, and Charset is used in a
> handful of places, I'm not sure it is common enough to warrant this
> type of API change. With that background, I would be interested to
> hear from others, but my initial thought is that PropertyValue methods
> should be focused on more common primitive and enum types.
>
> Regards,
> David Handermann
>
> On Thu, Jan 9, 2025 at 8:30 AM Dan S <dsti...@gmail.com> wrote:
> >
> > BLUF
> > I would like to propose adding a method to
> > org.apache.nifi.components.PropertyValue whose signature would be
> >
> > Charset asCharset();
> >
> > (where Charset is a java.nio.charset.Charset object)
> >
> > Background
> > While working NIFI-14135 <
> https://issues.apache.org/jira/browse/NIFI-14135>, I
> > noticed there are almost 40 lines between processors and controller
> > services which have the line
> >
> > final Charset charset =
> > Charset.forName(context.getProperty(CHARACTER_SET).getValue());
> >
> > and there are some which have code that look like
> >
> > final String charsetName = context.getProperty(CHARSET).getValue();
> >
> > but eventually have code later which converts the string into a Charset
> > object (e.g. Charset.forName(charsetName) ).
> >
> > It would seem to me this can all be simplified if we had a method in
> > org.apache.nifi.components.PropertyValue which converted the property
> value
> > to a java.nio.charset.Charset.
> >
> > Please let me know your thoughts on this proposal. Thanks!
>

Reply via email to