Interface NameGenerator

All Superinterfaces:
Serializable
All Known Implementing Classes:
DefaultNameGenerator, RandomNameGenerator

public interface NameGenerator extends Serializable
A class that generates unique JavaScript variable/property names.
  • Method Details

    • reset

      void reset(Set<String> reservedNames, String prefix, Set<Character> reservedCharacters)
      Reconfigures this NameGenerator, and resets it to the initial state.
      Parameters:
      reservedNames - set of names that are reserved; generated names will not include these names. This set is referenced rather than copied, so changes to the set will be reflected in how names are generated.
      prefix - all generated names begin with this prefix.
      reservedCharacters - characters that won't be used in generated names
    • reset

      void reset(Set<String> reservedNames, String prefix, Set<Character> reservedFirstCharacters, Set<Character> reservedNonFirstCharacters)
      Reconfigures this NameGenerator, and resets it to the initial state.
      Parameters:
      reservedNames - set of names that are reserved; generated names will not include these names. This set is referenced rather than copied, so changes to the set will be reflected in how names are generated.
      prefix - all generated names begin with this prefix.
      reservedFirstCharacters - If specified these characters won't be used as the first character in generated names.
      reservedNonFirstCharacters - If specified these characters won't be used for characters (after the first) in generated names.
    • clone

      NameGenerator clone(Set<String> reservedNames, String prefix, Set<Character> reservedCharacters)
      Returns a clone of this NameGenerator, reconfigured and reset.
    • generateNextName

      String generateNextName()
      Generates the next name.