Class FillRemainingCharactersAppender

java.lang.Object
org.passay.generate.FillRemainingCharactersAppender
All Implemented Interfaces:
CharacterAppender

public class FillRemainingCharactersAppender extends Object implements CharacterAppender
Character appender for filling a password with valid characters. This appender should be the last to execute for password generation.
  • Field Details

    • characters

      private final UnicodeString characters
      Valid characters.
    • random

      private final Random random
      To select random characters.
  • Constructor Details

    • FillRemainingCharactersAppender

      public FillRemainingCharactersAppender(List<? extends Rule> rules, UnicodeString allowedChars, UnicodeString illegalChars, Random rand)
      Creates a new fill appender.
      Parameters:
      rules - to derive characters from
      allowedChars - characters allowed for appending
      illegalChars - characters not allowed for appending
      rand - to randomize character selection
  • Method Details

    • getCharacters

      private UnicodeString getCharacters(List<? extends Rule> rules)
      Return a unicode string that contains the unique characters from all CharacterRule or CharacterCharacteristicsRule contained in the supplied list.
      Parameters:
      rules - to extract unique characters from
      Returns:
      unicode string containing unique characters or empty string
    • getCharacters

      public UnicodeString getCharacters()
      Description copied from interface: CharacterAppender
      Returns the characters that may be used in by this appender.
      Specified by:
      getCharacters in interface CharacterAppender
      Returns:
      valid characters
    • append

      public void append(CharBuffer target, int count)
      Description copied from interface: CharacterAppender
      Fills the target buffer with at most count characters from this appender.
      Specified by:
      append in interface CharacterAppender
      Parameters:
      target - buffer to add characters to
      count - maximum number of characters to add to buffer