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 code
linger - the linger, in milliseconds, after the code is released before being made available for reuse
length - 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 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 time
      linger - the linger time
      length - the length of the code
  • Method Details

    • userOptional

      public Optional<User> userOptional()
      Returns the user wrapped in an Optional.
      Returns:
      the user optional
    • profileOptional

      public Optional<Profile> profileOptional()
      Returns the profile wrapped in an Optional.
      Returns:
      the profile optional
    • withLength

      public static UniqueCodeDao.GenerationParameters withLength(int length)
      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

      public static UniqueCodeDao.GenerationParameters withLength(int length, User user)
      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

      public static UniqueCodeDao.GenerationParameters withLength(int length, Profile profile)
      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

      public static UniqueCodeDao.GenerationParameters defaults()
      Returns the default generation parameters.
      Returns:
      the default generation parameters
    • toString

      public final String 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.
      Specified by:
      toString in class 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:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • timeout

      public long timeout()
      Returns the value of the timeout record component.
      Returns:
      the value of the timeout record component
    • linger

      public long linger()
      Returns the value of the linger record component.
      Returns:
      the value of the linger record component
    • length

      public int length()
      Returns the value of the length record component.
      Returns:
      the value of the length record component
    • maxAttempts

      public int maxAttempts()
      Returns the value of the maxAttempts record component.
      Returns:
      the value of the maxAttempts record component
    • user

      public User user()
      Returns the value of the user record component.
      Returns:
      the value of the user record component
    • profile

      public Profile profile()
      Returns the value of the profile record component.
      Returns:
      the value of the profile record component