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 Summary

    Modifier and Type
    Method
    Description
    clone(Set<String> reservedNames, String prefix, char @Nullable [] reservedCharacters)
    Returns a clone of this NameGenerator, reconfigured and reset.
    Generates the next name.
    void
    reset(Set<String> reservedNames, String prefix, char @Nullable [] reservedCharacters)
    Reconfigures this NameGenerator, and resets it to the initial state.
    void
    reset(Set<String> reservedNames, String prefix, char @Nullable [] reservedFirstCharacters, char @Nullable [] reservedNonFirstCharacters)
    Reconfigures this NameGenerator, and resets it to the initial state.
  • Method Details

    • reset

      void reset(Set<String> reservedNames, String prefix, char @Nullable [] 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 - If specified these characters won't be used in generated names
    • reset

      void reset(Set<String> reservedNames, String prefix, char @Nullable [] reservedFirstCharacters, char @Nullable [] 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, char @Nullable [] reservedCharacters)
      Returns a clone of this NameGenerator, reconfigured and reset.
    • generateNextName

      String generateNextName()
      Generates the next name.