[lang] Considering a new String utility class

2023-03-15 Thread Gary Gregory
PRs and issues like "[LANG-1682] Adding new startsWithAnyIgnoreCase
method and tests cases" keep popping up from time to time.

My preference is to stop adding APIs that are variations of other APIs
based on case sensitivity (and Charset, Locale, and so on).

Instead, I can see adding a new String utility class that tracks such
attributes on its instance such that you'd say something like:
- Strings.caseSensitive().someOperation(...)
- Strings.caseInsensitive().someOperation(...).

The 2 above would access pre-built instances probably. A builder would
let you build an instance that your app can cache:
Strings.builder().setCaseSensitivity(true).setCharset(...).build();

An instance of Strings or whatever to call such a class would track
case sensitivity, a Locale, and maybe an input and output Charset, I'm
not 100% sure yet. But you get the idea I hope.

Any thoughts?

Gary

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Re: [lang] Considering a new String utility class

2023-03-15 Thread Melloware

This sounds like a great idea!


On 3/15/2023 8:58 AM, Gary Gregory wrote:

PRs and issues like "[LANG-1682] Adding new startsWithAnyIgnoreCase
method and tests cases" keep popping up from time to time.

My preference is to stop adding APIs that are variations of other APIs
based on case sensitivity (and Charset, Locale, and so on).

Instead, I can see adding a new String utility class that tracks such
attributes on its instance such that you'd say something like:
- Strings.caseSensitive().someOperation(...)
- Strings.caseInsensitive().someOperation(...).

The 2 above would access pre-built instances probably. A builder would
let you build an instance that your app can cache:
Strings.builder().setCaseSensitivity(true).setCharset(...).build();

An instance of Strings or whatever to call such a class would track
case sensitivity, a Locale, and maybe an input and output Charset, I'm
not 100% sure yet. But you get the idea I hope.

Any thoughts?

Gary

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Re: [lang] Considering a new String utility class

2023-03-15 Thread Matt Benson
Agreed, Gary. Sounds promising. Maybe consider the "modern" terser builder
style a la AWS builders or such (i.e. since the "mutator" isn't a classic
Java beans mutator in any case, you can omit "set").

Matt

On Wed, Mar 15, 2023, 8:06 AM Melloware  wrote:

> This sounds like a great idea!
>
>
> On 3/15/2023 8:58 AM, Gary Gregory wrote:
> > PRs and issues like "[LANG-1682] Adding new startsWithAnyIgnoreCase
> > method and tests cases" keep popping up from time to time.
> >
> > My preference is to stop adding APIs that are variations of other APIs
> > based on case sensitivity (and Charset, Locale, and so on).
> >
> > Instead, I can see adding a new String utility class that tracks such
> > attributes on its instance such that you'd say something like:
> > - Strings.caseSensitive().someOperation(...)
> > - Strings.caseInsensitive().someOperation(...).
> >
> > The 2 above would access pre-built instances probably. A builder would
> > let you build an instance that your app can cache:
> > Strings.builder().setCaseSensitivity(true).setCharset(...).build();
> >
> > An instance of Strings or whatever to call such a class would track
> > case sensitivity, a Locale, and maybe an input and output Charset, I'm
> > not 100% sure yet. But you get the idea I hope.
> >
> > Any thoughts?
> >
> > Gary
> >
> > -
> > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> > For additional commands, e-mail: dev-h...@commons.apache.org
> >
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>


Re: [lang] Considering a new String utility class

2023-03-15 Thread Jochen Wiedmann
On Wed, Mar 15, 2023 at 1:58 PM Gary Gregory  wrote:

> Instead, I can see adding a new String utility class that tracks such
> attributes on its instance such that you'd say something like:
> - Strings.caseSensitive().someOperation(...)
> - Strings.caseInsensitive().someOperation(...).

Agreed 100%, because this would allow to reduce static methods to an
absolute minimum
(The builder provider(s).)

Jochen

-- 
Philosophy is useless, theology is worse. (Industrial Disease, Dire Straits)

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Re: [lang] Considering a new String utility class

2023-03-15 Thread Gary Gregory
On Wed, Mar 15, 2023 at 9:11 AM Matt Benson  wrote:
>
> Agreed, Gary. Sounds promising. Maybe consider the "modern" terser builder
> style a la AWS builders or such (i.e. since the "mutator" isn't a classic
> Java beans mutator in any case, you can omit "set").

So a setter is called foo(value) and the getter is called foo()? Kinda
confusing IMO.

Gary

>
> Matt
>
> On Wed, Mar 15, 2023, 8:06 AM Melloware  wrote:
>
> > This sounds like a great idea!
> >
> >
> > On 3/15/2023 8:58 AM, Gary Gregory wrote:
> > > PRs and issues like "[LANG-1682] Adding new startsWithAnyIgnoreCase
> > > method and tests cases" keep popping up from time to time.
> > >
> > > My preference is to stop adding APIs that are variations of other APIs
> > > based on case sensitivity (and Charset, Locale, and so on).
> > >
> > > Instead, I can see adding a new String utility class that tracks such
> > > attributes on its instance such that you'd say something like:
> > > - Strings.caseSensitive().someOperation(...)
> > > - Strings.caseInsensitive().someOperation(...).
> > >
> > > The 2 above would access pre-built instances probably. A builder would
> > > let you build an instance that your app can cache:
> > > Strings.builder().setCaseSensitivity(true).setCharset(...).build();
> > >
> > > An instance of Strings or whatever to call such a class would track
> > > case sensitivity, a Locale, and maybe an input and output Charset, I'm
> > > not 100% sure yet. But you get the idea I hope.
> > >
> > > Any thoughts?
> > >
> > > Gary
> > >
> > > -
> > > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> > > For additional commands, e-mail: dev-h...@commons.apache.org
> > >
> >
> > -
> > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> > For additional commands, e-mail: dev-h...@commons.apache.org
> >
> >

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Re: [lang] Considering a new String utility class

2023-03-15 Thread Hasan Diwan
+1

On Wed, 15 Mar 2023 at 05:58, Gary Gregory  wrote:

> PRs and issues like "[LANG-1682] Adding new startsWithAnyIgnoreCase
> method and tests cases" keep popping up from time to time.
>
> My preference is to stop adding APIs that are variations of other APIs
> based on case sensitivity (and Charset, Locale, and so on).
>
> Instead, I can see adding a new String utility class that tracks such
> attributes on its instance such that you'd say something like:
> - Strings.caseSensitive().someOperation(...)
> - Strings.caseInsensitive().someOperation(...).
>
> The 2 above would access pre-built instances probably. A builder would
> let you build an instance that your app can cache:
> Strings.builder().setCaseSensitivity(true).setCharset(...).build();
>
> An instance of Strings or whatever to call such a class would track
> case sensitivity, a Locale, and maybe an input and output Charset, I'm
> not 100% sure yet. But you get the idea I hope.
>
> Any thoughts?
>
> Gary
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>

-- 
OpenPGP: https://hasan.d8u.us/openpgp.asc
If you wish to request my time, please do so using
*bit.ly/hd1AppointmentRequest
*.
Si vous voudrais faire connnaisance, allez a *bit.ly/hd1AppointmentRequest
*.

Sent
from my mobile device
Envoye de mon portable


Re: [lang] Considering a new String utility class

2023-03-15 Thread Matt Benson
On Wed, Mar 15, 2023 at 9:47 PM Gary Gregory  wrote:

> On Wed, Mar 15, 2023 at 9:11 AM Matt Benson  wrote:
> >
> > Agreed, Gary. Sounds promising. Maybe consider the "modern" terser
> builder
> > style a la AWS builders or such (i.e. since the "mutator" isn't a classic
> > Java beans mutator in any case, you can omit "set").
>
> So a setter is called foo(value) and the getter is called foo()? Kinda
> confusing IMO.
>
>
If you can't handle that, we could go for a fluent "with" syntax. But don't
overload the "set" idiom.

Matt


> Gary
>
> >
> > Matt
> >
> > On Wed, Mar 15, 2023, 8:06 AM Melloware  wrote:
> >
> > > This sounds like a great idea!
> > >
> > >
> > > On 3/15/2023 8:58 AM, Gary Gregory wrote:
> > > > PRs and issues like "[LANG-1682] Adding new startsWithAnyIgnoreCase
> > > > method and tests cases" keep popping up from time to time.
> > > >
> > > > My preference is to stop adding APIs that are variations of other
> APIs
> > > > based on case sensitivity (and Charset, Locale, and so on).
> > > >
> > > > Instead, I can see adding a new String utility class that tracks such
> > > > attributes on its instance such that you'd say something like:
> > > > - Strings.caseSensitive().someOperation(...)
> > > > - Strings.caseInsensitive().someOperation(...).
> > > >
> > > > The 2 above would access pre-built instances probably. A builder
> would
> > > > let you build an instance that your app can cache:
> > > > Strings.builder().setCaseSensitivity(true).setCharset(...).build();
> > > >
> > > > An instance of Strings or whatever to call such a class would track
> > > > case sensitivity, a Locale, and maybe an input and output Charset,
> I'm
> > > > not 100% sure yet. But you get the idea I hope.
> > > >
> > > > Any thoughts?
> > > >
> > > > Gary
> > > >
> > > > -
> > > > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> > > > For additional commands, e-mail: dev-h...@commons.apache.org
> > > >
> > >
> > > -
> > > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> > > For additional commands, e-mail: dev-h...@commons.apache.org
> > >
> > >
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>


Re: [lang] Considering a new String utility class

2023-03-15 Thread Hasan Diwan
On Wed, 15 Mar 2023 at 20:55, Matt Benson  wrote:

> > > > > Any thoughts?
>

Something like:

> StringUtils2.ignoreCase() /* makes the next functions case insensitive
*/.respectCase(). * back to case-sensitive */

? -- H

-- 
OpenPGP: https://hasan.d8u.us/openpgp.asc
If you wish to request my time, please do so using
*bit.ly/hd1AppointmentRequest
*.
Si vous voudrais faire connnaisance, allez a *bit.ly/hd1AppointmentRequest
*.

Sent
from my mobile device
Envoye de mon portable


Re: [lang] Considering a new String utility class

2023-03-15 Thread Matt Benson
On Wed, Mar 15, 2023 at 11:10 PM Hasan Diwan  wrote:

> On Wed, 15 Mar 2023 at 20:55, Matt Benson  wrote:
>
> > > > > > Any thoughts?
> >
>
> Something like:
>
> > StringUtils2.ignoreCase() /* makes the next functions case insensitive
> */.respectCase(). * back to case-sensitive */
>
>
What about something like:

enum CaseSensitivity { CS, NONCS }

with(CaseSensitivity o);

Matt


> ? -- H
>
> --
> OpenPGP: https://hasan.d8u.us/openpgp.asc
> If you wish to request my time, please do so using
> *bit.ly/hd1AppointmentRequest
> *.
> Si vous voudrais faire connnaisance, allez a *bit.ly/hd1AppointmentRequest
> *.
>
>  >Sent
> from my mobile device
> Envoye de mon portable
>