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

Duncan Jones commented on TEXT-38:
----------------------------------

I'd be happy to make this change. It would make it easier to move towards a 
thread-safe implementation.

I propose we rename the class to {{RandomStringGenerator}} and create an inner 
{{Builder}} class. I would also propose we force callers to construct the 
generator using the builder (i.e. the {{RandomStringGenerator}} is private.

Sound ok? If so, I'll make that change.

> Fluent API in "RandomStringBuilder"
> -----------------------------------
>
>                 Key: TEXT-38
>                 URL: https://issues.apache.org/jira/browse/TEXT-38
>             Project: Commons Text
>          Issue Type: Improvement
>            Reporter: Gilles
>              Labels: api
>             Fix For: 1.0
>
>
> It can be construed as potentially dangerous to let user code change any of 
> the settings of the builder, as other parts of the code could be using a 
> reference to the same instance.
> In Commons Math, where the fluent API pattern was applied, a new builder 
> (immutable) instance would be created.  For example, see [this 
> class|https://git1-us-west.apache.org/repos/asf?p=commons-math.git;a=blob;f=src/main/java/org/apache/commons/math4/fitting/SimpleCurveFitter.java;h=54f6cbfe1e003cec74f2b0e71efc1b13000a5525;hb=HEAD].



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

Reply via email to