Record Class PasswordLoginRateLimiter.Decision

java.lang.Object
java.lang.Record
io.leandev.appfuse.security.auth.PasswordLoginRateLimiter.Decision
Enclosing interface:
PasswordLoginRateLimiter

public static record PasswordLoginRateLimiter.Decision(boolean allowed, int limit, int remaining, Instant resetAt, long retryAfterSeconds, boolean degraded) extends Record
resetAt 是下一個名額可用時間;retryAfterSeconds 是向上取整的等待秒數。 degraded=true 時配額未知(remaining=-1、resetAt=null),仍需執行所有認證與 SQL 檢查。
  • Constructor Summary

    Constructors
    Constructor
    Description
    Decision(boolean allowed, int limit, int remaining, Instant resetAt, long retryAfterSeconds, boolean degraded)
    Creates an instance of a Decision record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns the value of the allowed record component.
    boolean
    Returns the value of the degraded record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the limit record component.
    int
    Returns the value of the remaining record component.
    Returns the value of the resetAt record component.
    long
    Returns the value of the retryAfterSeconds record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Decision

      public Decision(boolean allowed, int limit, int remaining, Instant resetAt, long retryAfterSeconds, boolean degraded)
      Creates an instance of a Decision record class.
      Parameters:
      allowed - the value for the allowed record component
      limit - the value for the limit record component
      remaining - the value for the remaining record component
      resetAt - the value for the resetAt record component
      retryAfterSeconds - the value for the retryAfterSeconds record component
      degraded - the value for the degraded record component
  • Method Details

    • 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 the compare method from their corresponding wrapper classes.
      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.
    • allowed

      public boolean allowed()
      Returns the value of the allowed record component.
      Returns:
      the value of the allowed record component
    • limit

      public int limit()
      Returns the value of the limit record component.
      Returns:
      the value of the limit record component
    • remaining

      public int remaining()
      Returns the value of the remaining record component.
      Returns:
      the value of the remaining record component
    • resetAt

      public Instant resetAt()
      Returns the value of the resetAt record component.
      Returns:
      the value of the resetAt record component
    • retryAfterSeconds

      public long retryAfterSeconds()
      Returns the value of the retryAfterSeconds record component.
      Returns:
      the value of the retryAfterSeconds record component
    • degraded

      public boolean degraded()
      Returns the value of the degraded record component.
      Returns:
      the value of the degraded record component