Package net.bytebuddy.utility
Class RandomString
java.lang.Object
net.bytebuddy.utility.RandomString
A provider of randomized
String
values.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The default length of a randomizedString
.private static final int
The amount of bits to extract out of an integer for each key generated.private final int
The length of the random strings that are created by this instance.private final Random
A provider of random values.private static final char[]
The symbols which are used to create a randomString
. -
Constructor Summary
ConstructorsConstructorDescriptionRandomString
(int length) Creates a randomString
provider where each value is of the given length.RandomString
(int length, Random random) Creates a randomString
provider where each value is of the given length. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
hashOf
(int value) Represents an integer value as a string hash.static String
Represents a object value as a string hash.static String
make()
Creates a randomString
ofDEFAULT_LENGTH
length.static String
make
(int length) Creates a randomString
of the givenlength
.Creates a new randomString
.
-
Field Details
-
DEFAULT_LENGTH
public static final int DEFAULT_LENGTHThe default length of a randomizedString
.- See Also:
-
SYMBOL
private static final char[] SYMBOLThe symbols which are used to create a randomString
. -
KEY_BITS
private static final int KEY_BITSThe amount of bits to extract out of an integer for each key generated. -
random
A provider of random values. -
length
private final int lengthThe length of the random strings that are created by this instance.
-
-
Constructor Details
-
RandomString
public RandomString() -
RandomString
public RandomString(int length) Creates a randomString
provider where each value is of the given length.- Parameters:
length
- The length of the randomString
.
-
RandomString
Creates a randomString
provider where each value is of the given length.- Parameters:
length
- The length of the randomString
.random
- The random number generator to use.
-
-
Method Details
-
make
Creates a randomString
ofDEFAULT_LENGTH
length.- Returns:
- A random
String
.
-
make
Creates a randomString
of the givenlength
. -
hashOf
Represents a object value as a string hash. This string is not technically random but generates a fixed character sequence based on the hash provided.- Parameters:
value
- The value to represent as a string ornull
.- Returns:
- A string representing the supplied value as a string.
-
hashOf
Represents an integer value as a string hash. This string is not technically random but generates a fixed character sequence based on the hash provided.- Parameters:
value
- The value to represent as a string.- Returns:
- A string representing the supplied value as a string.
-
nextString
Creates a new randomString
.- Returns:
- A random
String
of the given length for this instance.
-