Record RandomStringGenerator
java.lang.Object
java.lang.Record
io.memoria.jutils.adapter.generator.RandomStringGenerator
- All Implemented Interfaces:
StringGenerator
public record RandomStringGenerator(java.util.Random random) extends java.lang.Record implements StringGenerator
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringALPHANUMERIC -
Constructor Summary
Constructors Constructor Description RandomStringGenerator(java.util.Random random)Creates an instance of aRandomStringGeneratorrecord. -
Method Summary
Modifier and Type Method Description java.lang.Stringalphanumeric(int length)booleanequals(java.lang.Object o)Indicates whether some other object is "equal to" this one.inthashCode()Returns a hash code value for this object.java.lang.Stringhex(int length)java.lang.StringminMaxAlphanumeric(int min, int max)java.lang.StringminMaxHex(int min, int max)java.util.Randomrandom()Returns the value of therandomrecord component.java.lang.StringtoString()Returns a string representation of this record.
-
Field Details
-
ALPHANUMERIC
public static final java.lang.String ALPHANUMERIC- See Also:
- Constant Field Values
-
-
Constructor Details
-
RandomStringGenerator
public RandomStringGenerator(java.util.Random random)Creates an instance of aRandomStringGeneratorrecord.- Parameters:
random- the value for therandomrecord component
-
-
Method Details
-
alphanumeric
public java.lang.String alphanumeric(int length)- Specified by:
alphanumericin interfaceStringGenerator
-
hex
public java.lang.String hex(int length)- Specified by:
hexin interfaceStringGenerator
-
minMaxAlphanumeric
public java.lang.String minMaxAlphanumeric(int min, int max)- Specified by:
minMaxAlphanumericin interfaceStringGenerator
-
minMaxHex
public java.lang.String minMaxHex(int min, int max)- Specified by:
minMaxHexin interfaceStringGenerator
-
toString
public java.lang.String toString()Returns a string representation of this record. The representation contains the name of the type, followed by the name and value of each of the record components.- Specified by:
toStringin classjava.lang.Record- Returns:
- a string representation of this object
-
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components.- Specified by:
hashCodein classjava.lang.Record- Returns:
- a hash code value for this object
-
equals
public final boolean equals(java.lang.Object o)Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record are compared withObjects::equals(Object,Object).- Specified by:
equalsin classjava.lang.Record- Parameters:
o- the object with which to compare- Returns:
trueif this object is the same as theoargument;falseotherwise.
-
random
public java.util.Random random()Returns the value of therandomrecord component.- Returns:
- the value of the
randomrecord component
-