IdGenerator.generateId

<p> Generate an ID based on the provided text and previously generated IDs. <p> This method is not thread safe, concurrent calls can end up with non-unique identifiers. <p> Note that collision can occur in the case that <ul> <li>Method called with 'X'</li> <li>Method called with 'X' again</li> <li>Method called with 'X-1'</li> </ul> <p> In that case, the three generated IDs will be: <ul> <li>X</li> <li>X-1</li> <li>X-1</li> </ul> <p> Therefore if collisions are unacceptable you should ensure that numbers are stripped from end of {@code text}.

@param text Text that the identifier should be based on. Will be normalised, then used to generate the identifier. @return {@code text} if this is the first instance that the {@code text} has been passed to the method. Otherwise, {@code text ~ "-" ~ X} will be returned, where X is the number of times that {@code text} has previously been passed in. If {@code text} is empty, the default identifier given in the constructor will be used.

class IdGenerator
string
generateId
(
string text
)

Meta