Record Class StateParameter.StateData

java.lang.Object
java.lang.Record
cloud.opencode.base.oauth2.security.StateParameter.StateData
Record Components:
state - the state parameter value | state 参数值
createdAt - the creation timestamp | 创建时间戳
Enclosing class:
StateParameter

public static record StateParameter.StateData(String state, Instant createdAt) extends Record
State Data Record State 数据记录

Holds a state parameter together with its creation timestamp, allowing expiration-based validation.

将 state 参数与其创建时间戳一起保存,允许基于过期的验证。

Since:
JDK 25, opencode-base-oauth2 V1.0.3
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • StateData

      public StateData(String state, Instant createdAt)
      Compact constructor with validation. 带验证的紧凑构造器。
  • Method Details

    • isExpired

      public boolean isExpired(Duration maxAge)
      Check if this state data has expired based on the given maximum age. 检查此 state 数据是否已根据给定的最大年龄过期。
      Parameters:
      maxAge - the maximum allowed age | 允许的最大年龄
      Returns:
      true if the state has expired | 如果 state 已过期返回 true
      Throws:
      NullPointerException - if maxAge is null | 如果 maxAge 为 null
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • state

      public String state()
      Returns the value of the state record component.
      Returns:
      the value of the state record component
    • createdAt

      public Instant createdAt()
      Returns the value of the createdAt record component.
      Returns:
      the value of the createdAt record component