java.lang.Object
com.atlassian.bitbucket.jenkins.internal.applink.oauth.RandomizerImpl
All Implemented Interfaces:
Randomizer

public class RandomizerImpl extends Object implements Randomizer
Implementation of Randomizer that generates random strings of specified lengths and specific character sets (e.g. alphanumeric characters, or URL-safe characters).
As a result, the strings generated by this class can safely be passed as part of a URL (e.g. via query parameters).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Generates and returns a random alphanumeric string of the specified length.
    randomUrlSafeString(int length)
    Generates a URL-safe random string with the given length
    The resulting string will contain ASCII characters [0-9], [A-Z], and [a-z], as well as the URL-safe characters '-' and '_', and can be safely used anywhere in the URL, including as query parameters

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RandomizerImpl

      public RandomizerImpl()
  • Method Details

    • randomAlphanumericString

      public String randomAlphanumericString(int length)
      Description copied from interface: Randomizer
      Generates and returns a random alphanumeric string of the specified length.
      Specified by:
      randomAlphanumericString in interface Randomizer
      Parameters:
      length - length of the random string (in chars)
      Returns:
      random alphanumeric string of the specified length
    • randomUrlSafeString

      public String randomUrlSafeString(int length)
      Description copied from interface: Randomizer
      Generates a URL-safe random string with the given length
      The resulting string will contain ASCII characters [0-9], [A-Z], and [a-z], as well as the URL-safe characters '-' and '_', and can be safely used anywhere in the URL, including as query parameters
      Specified by:
      randomUrlSafeString in interface Randomizer
      Parameters:
      length - length of the random string (in chars)
      Returns:
      random URL-safe string of the specified length