Record Class CaptchaMetrics.MetricsSnapshot
java.lang.Object
java.lang.Record
cloud.opencode.base.captcha.support.CaptchaMetrics.MetricsSnapshot
- Record Components:
totalGenerated- total CAPTCHAs generated | 生成的验证码总数totalValidations- total validation attempts | 验证尝试总数successfulValidations- successful validations | 验证成功次数failedValidations- failed validations | 验证失败次数successRate- validation success rate (0.0 to 1.0) | 验证成功率(0.0 到 1.0)averageResponseTime- average validation response time | 平均验证响应时间generationsByType- generation counts per type | 按类型的生成次数uptime- time since metrics creation or last reset | 自指标创建或上次重置以来的时间
- Enclosing class:
CaptchaMetrics
public static record CaptchaMetrics.MetricsSnapshot(long totalGenerated, long totalValidations, long successfulValidations, long failedValidations, double successRate, Duration averageResponseTime, Map<CaptchaType, Long> generationsByType, Duration uptime)
extends Record
Immutable Metrics Snapshot - Point-in-time capture of all CAPTCHA metrics
不可变指标快照 - 所有验证码指标的时间点捕获
This record holds an immutable snapshot of all metric values at the time
of creation. The generationsByType map is defensively copied.
此记录保存创建时所有指标值的不可变快照。generationsByType 映射会进行防御性复制。
- Since:
- JDK 25, opencode-base-captcha V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMetricsSnapshot(long totalGenerated, long totalValidations, long successfulValidations, long failedValidations, double successRate, Duration averageResponseTime, Map<CaptchaType, Long> generationsByType, Duration uptime) Compact constructor that performs defensive copy of the generationsByType map. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theaverageResponseTimerecord component.final booleanIndicates whether some other object is "equal to" this one.longReturns the value of thefailedValidationsrecord component.Returns the value of thegenerationsByTyperecord component.final inthashCode()Returns a hash code value for this object.longReturns the value of thesuccessfulValidationsrecord component.doubleReturns the value of thesuccessRaterecord component.final StringtoString()Returns a string representation of this record class.longReturns the value of thetotalGeneratedrecord component.longReturns the value of thetotalValidationsrecord component.uptime()Returns the value of theuptimerecord component.
-
Constructor Details
-
MetricsSnapshot
public MetricsSnapshot(long totalGenerated, long totalValidations, long successfulValidations, long failedValidations, double successRate, Duration averageResponseTime, Map<CaptchaType, Long> generationsByType, Duration uptime) Compact constructor that performs defensive copy of the generationsByType map. 紧凑构造器,对 generationsByType 映射执行防御性复制。- Throws:
NullPointerException- if averageResponseTime, generationsByType, or uptime is null | 如果 averageResponseTime、generationsByType 或 uptime 为 null
-
-
Method Details
-
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
totalGenerated
public long totalGenerated()Returns the value of thetotalGeneratedrecord component.- Returns:
- the value of the
totalGeneratedrecord component
-
totalValidations
public long totalValidations()Returns the value of thetotalValidationsrecord component.- Returns:
- the value of the
totalValidationsrecord component
-
successfulValidations
public long successfulValidations()Returns the value of thesuccessfulValidationsrecord component.- Returns:
- the value of the
successfulValidationsrecord component
-
failedValidations
public long failedValidations()Returns the value of thefailedValidationsrecord component.- Returns:
- the value of the
failedValidationsrecord component
-
successRate
public double successRate()Returns the value of thesuccessRaterecord component.- Returns:
- the value of the
successRaterecord component
-
averageResponseTime
Returns the value of theaverageResponseTimerecord component.- Returns:
- the value of the
averageResponseTimerecord component
-
generationsByType
Returns the value of thegenerationsByTyperecord component.- Returns:
- the value of the
generationsByTyperecord component
-
uptime
-