[ 
https://issues.apache.org/jira/browse/TEXT-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15762116#comment-15762116
 ] 

Duncan Jones commented on TEXT-34:
----------------------------------

Thanks for the feedback Emmanuel. It's great you have a real life use case we 
can examine.

One concern I had about adding that functionality was it didn't seem very 
text-oriented to me. It is essentially selecting random objects from an array; 
the objects just happen to be {{char}} or {{int}} values. 

The specific functionality you describe can be achieved with the filters, but I 
appreciate that was only an example:

{code:java}
String licence = new 
RandomStringBuilder().ofLength(20).withMinimum('A').withMaximum('Z')
        .filteredBy(new CodePointPredicate() {
            @Override
            public boolean test(int codePoint) {
                return codePoint != 'O' && codePoint != 'I';
            }
        }).build();
{code}

So, in short, it was a deliberate omission, but I forgot to kick off the 
discussion about whether it was a good idea!

By the way, I'm not suggesting filters are an appropriate substitution for the 
original functionality. There's no efficient way you can use filters to create 
an arbitrary collection of characters. I'm questioning whether the original 
functionality belongs in a text-processing component.

> Add class to generate random strings
> ------------------------------------
>
>                 Key: TEXT-34
>                 URL: https://issues.apache.org/jira/browse/TEXT-34
>             Project: Commons Text
>          Issue Type: New Feature
>            Reporter: Duncan Jones
>            Assignee: Duncan Jones
>
> The {{RandomStringUtils}} class will be deprecated in Commons Lang and reborn 
> in Commons Text.
> Because the original class has some complicated parameters and potentially 
> unnecessary capabilities, I'll simplify as I move it across. I'll also ensure 
> the class plays nicely with Unicode characters.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to