Top Description Fields Constructors Methods
net.bytebuddy.utility

public Class RandomString

extends Object
Class Inheritance
Imports
edu.umd.cs.findbugs.annotations.SuppressFBWarnings, net.bytebuddy.utility.nullability.MaybeNull, java.util.Random

A provider of randomized java.lang.String values.

Field Summary

Modifier and TypeField and Description
public static final int
DEFAULT_LENGTH

The default length of a randomized java.lang.String.

private static final int
KEY_BITS

The amount of bits to extract out of an integer for each key generated.

private final int
length

The length of the random strings that are created by this instance.

private final Random
random

A provider of random values.

private static final char[]
SYMBOL

The symbols which are used to create a random java.lang.String.

Constructor Summary

AccessConstructor and Description
public
public
RandomString(int
The length of the random String.
length
)

Creates a random java.lang.String provider where each value is of the given length.

public
RandomString(int
The length of the random String.
length
,
Random
The random number generator to use.
random
)

Creates a random java.lang.String provider where each value is of the given length.

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

A string representing the supplied value as a string.
hashOf
(Object
The value to represent as a string or null.
value
)

Represents a object value as a string hash.

public static String

Returns:

A string representing the supplied value as a string.
hashOf
(int
The value to represent as a string.
value
)

Represents an integer value as a string hash.

public static String
public static String

Returns:

A random java.lang.String.
make
(int
The length of the random String.
length
)

Creates a random java.lang.String of the given length.

public String

Returns:

A random java.lang.String of the given length for this instance.
nextString
()

Creates a new random java.lang.String.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_LENGTHback to summary
public static final int DEFAULT_LENGTH

The default length of a randomized java.lang.String.

KEY_BITSback to summary
private static final int KEY_BITS

The amount of bits to extract out of an integer for each key generated.

lengthback to summary
private final int length

The length of the random strings that are created by this instance.

randomback to summary
private final Random random

A provider of random values.

SYMBOLback to summary
private static final char[] SYMBOL

The symbols which are used to create a random java.lang.String.

Constructor Detail

RandomStringback to summary
public RandomString()

Creates a random java.lang.String provider where each java.lang.String is of net.bytebuddy.utility.RandomString#DEFAULT_LENGTH length.

RandomStringback to summary
public RandomString(int length)

Creates a random java.lang.String provider where each value is of the given length.

Parameters
length:int

The length of the random String.

RandomStringback to summary
public RandomString(int length, Random random)

Creates a random java.lang.String provider where each value is of the given length.

Parameters
length:int

The length of the random String.

random:Random

The random number generator to use.

Method Detail

hashOfback to summary
public static String hashOf(Object value)

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:Object

The value to represent as a string or null.

Returns:String

A string representing the supplied value as a string.

hashOfback to summary
public static String hashOf(int value)

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:int

The value to represent as a string.

Returns:String

A string representing the supplied value as a string.

makeback to summary
public static String make()

Creates a random java.lang.String of net.bytebuddy.utility.RandomString#DEFAULT_LENGTH length.

Returns:String

A random java.lang.String.

makeback to summary
public static String make(int length)

Creates a random java.lang.String of the given length.

Parameters
length:int

The length of the random String.

Returns:String

A random java.lang.String.

nextStringback to summary
public String nextString()

Creates a new random java.lang.String.

Returns:String

A random java.lang.String of the given length for this instance.

Annotations
@SuppressFBWarnings:DMI_RANDOM_USED_ONLY_ONCE
justification:Random value is used on each invocation.