Class RandomizerImpl
- java.lang.Object
-
- com.atlassian.bitbucket.jenkins.internal.applink.oauth.RandomizerImpl
-
- All Implemented Interfaces:
Randomizer
public class RandomizerImpl extends Object implements Randomizer
Implementation ofRandomizerthat generates random strings of specified lengths and specific character sets (e.g.alphanumeric characters, orURL-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 RandomizerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringrandomAlphanumericString(int length)Generates and returns a random alphanumeric string of the specified length.StringrandomUrlSafeString(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
-
-
-
Method Detail
-
randomAlphanumericString
public String randomAlphanumericString(int length)
Description copied from interface:RandomizerGenerates and returns a random alphanumeric string of the specified length.- Specified by:
randomAlphanumericStringin interfaceRandomizer- 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:RandomizerGenerates 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:
randomUrlSafeStringin interfaceRandomizer- Parameters:
length- length of the random string (in chars)- Returns:
- random URL-safe string of the specified length
-
-