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 ofRandomizer
that 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 String
randomAlphanumericString(int length)
Generates and returns a random alphanumeric string of the specified length.String
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
-
-
-
Method Detail
-
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 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: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 interfaceRandomizer
- Parameters:
length
- length of the random string (in chars)- Returns:
- random URL-safe string of the specified length
-
-