public final class UniqueNameGenerator extends Object
| Constructor and Description |
|---|
UniqueNameGenerator(com.google.common.base.CharMatcher bannedCharacters,
String collisionSeparator) |
| Modifier and Type | Method and Description |
|---|---|
void |
claimName(String name)
Registers the name, throwing an IllegalArgumentException if it has already been registered.
|
String |
generateName(String name)
Returns a name based on the supplied one that is guaranteed to be unique among the names that
have been returned by this method.
|
boolean |
hasName(String name) |
void |
reserve(Iterable<String> names)
Reserves the names, useful for keywords.
|
void |
reserve(String name)
Reserves the name, useful for keywords.
|
public UniqueNameGenerator(com.google.common.base.CharMatcher bannedCharacters,
String collisionSeparator)
public void claimName(String name)
public void reserve(String name)
public String generateName(String name)
public boolean hasName(String name)