Interface Username

All Superinterfaces:
Normalisable<Username>, org.wiremock.stringparser.ParsedString, PercentEncoded<Username>

public interface Username extends PercentEncoded<Username>, org.wiremock.stringparser.ParsedString
Represents the username portion of user information in a URI authority.

The username is the part before the colon in user information (username:password). Usernames may contain percent-encoded characters.

Implementations must be immutable and thread-safe.

See Also:
  • Method Details

    • parse

      static Username parse(String username) throws IllegalUsername
      Parses a string into a username.
      Parameters:
      username - the string to parse
      Returns:
      the parsed username
      Throws:
      IllegalUsername - if the string is not a valid username
    • encode

      static Username encode(String unencoded)
      Encodes a string into a valid username with proper percent-encoding.
      Parameters:
      unencoded - the unencoded string
      Returns:
      the encoded username