Package dev.getelements.elements.sdk.dao
Record Class UniqueCodeDao.GenerationParameters
java.lang.Object
java.lang.Record
dev.getelements.elements.sdk.dao.UniqueCodeDao.GenerationParameters
- Record Components:
timeout- the timeout, in milliseconds, for the codelinger- the linger, in milliseconds, after the code is released before being made available for reuselength- the length of the generated code. Implementations may force specific rules on the length but must support a minimum of 4 characters and a maximum of 8 characters.
- Enclosing interface:
UniqueCodeDao
public static record UniqueCodeDao.GenerationParameters(long timeout, long linger, int length, int maxAttempts, User user, Profile profile)
extends Record
Generation parameters for generating unique codes.
-
Constructor Summary
ConstructorsConstructorDescriptionGenerationParameters(long timeout, long linger, int length, int maxAttempts, User user, Profile profile) Constructor that sets default values for any parameters that are zero, and resolves the user from the profile if provided. -
Method Summary
Modifier and TypeMethodDescriptiondefaults()Returns the default generation parameters.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intlength()Returns the value of thelengthrecord component.longlinger()Returns the value of thelingerrecord component.intReturns the value of themaxAttemptsrecord component.profile()Returns the value of theprofilerecord component.Returns the profile wrapped in an Optional.longtimeout()Returns the value of thetimeoutrecord component.final StringtoString()Returns a string representation of this record class.user()Returns the value of theuserrecord component.Returns the user wrapped in an Optional.withLength(int length) Creates generation parameters with the specified length and default values for other parameters.withLength(int length, Profile profile) Creates generation parameters with the specified length and default values for other parameters.withLength(int length, User user) Creates generation parameters with the specified length and default values for other parameters.
-
Constructor Details
-
GenerationParameters
public GenerationParameters(long timeout, long linger, int length, int maxAttempts, User user, Profile profile) Constructor that sets default values for any parameters that are zero, and resolves the user from the profile if provided.- Parameters:
timeout- the timeout timelinger- the linger timelength- the length of the code
-
-
Method Details
-
userOptional
Returns the user wrapped in an Optional.- Returns:
- the user optional
-
profileOptional
Returns the profile wrapped in an Optional.- Returns:
- the profile optional
-
withLength
Creates generation parameters with the specified length and default values for other parameters.- Parameters:
length- the length of the code- Returns:
- the generation parameters
-
withLength
Creates generation parameters with the specified length and default values for other parameters.- Parameters:
length- the length of the code- Returns:
- the generation parameters
-
withLength
Creates generation parameters with the specified length and default values for other parameters.- Parameters:
length- the length of the code- Returns:
- the generation parameters
-
defaults
Returns the default generation parameters.- Returns:
- the default generation parameters
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
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. -
equals
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
timeout
public long timeout()Returns the value of thetimeoutrecord component.- Returns:
- the value of the
timeoutrecord component
-
linger
public long linger()Returns the value of thelingerrecord component.- Returns:
- the value of the
lingerrecord component
-
length
public int length()Returns the value of thelengthrecord component.- Returns:
- the value of the
lengthrecord component
-
maxAttempts
public int maxAttempts()Returns the value of themaxAttemptsrecord component.- Returns:
- the value of the
maxAttemptsrecord component
-
user
Returns the value of theuserrecord component.- Returns:
- the value of the
userrecord component
-
profile
Returns the value of theprofilerecord component.- Returns:
- the value of the
profilerecord component
-