[
https://issues.apache.org/jira/browse/LANG-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592666#action_12592666
]
Robert Scholte commented on LANG-425:
-------------------------------------
That was my first idea too, but after having some thoughts I don't think this
would be the right way, or at least not the only one.
The code you suggest is covered by
[commons-id|http://commons.apache.org/sandbox/id/] (a sandbox and 1.0-snapshot
project)
What they do is:
{code} IdentifierGeneratorFactory factory =
IdentifierGeneratorFactory.newInstance();
StringIdentifierGenerator generator = factory.alphanumericGenerator();
String id = generator.nextStringIdentifier();
{code}
But for commons-lang this approach might be a bit overdone.
Maybe both ways must be supported: a memento (statefull)-version and a utils
(stateless)-version.
If you want to loop, use the first option. If you just want the next, use the
second.
For a simple String+1 you shouldn't need to create an object by constructor and
call it's nextString()
> Sequence(String)Utils
> ---------------------
>
> Key: LANG-425
> URL: https://issues.apache.org/jira/browse/LANG-425
> Project: Commons Lang
> Issue Type: Wish
> Affects Versions: 2.4
> Reporter: Robert Scholte
> Priority: Trivial
>
> Don't you think it's kind of strange to have RandomUtils and
> RandomStringUtils, but not just the ordinairy SequenceUtils?
> I've seen commons-id in the sandbox, but maybe some basics should become part
> of commons lang.
> Most classes of within this package are stateless/static, or they have a
> state within a method (such as StrBuilder). SequenceUtils can only be static,
> if it has the startValue.
> For example
> {code}
> SequenceUtils.nextInt(10)
> SequenceUtils.nextString("MORE")
> SequenceUtils.nextBoolean(true) //ok, this one is stupid but quite clear
> SequenceUtils.nextString("C0DE", "0123456789ABCDEF") //next hexadecimal
> {code}
> any more ideas?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.