Record Class RateLimitDecision.Allowed
java.lang.Object
java.lang.Record
com.svenruppert.jsentinel.ratelimiting.RateLimitDecision.Allowed
- All Implemented Interfaces:
RateLimitDecision
- Enclosing interface:
RateLimitDecision
public static record RateLimitDecision.Allowed(int eventsInWindow, int limit, Duration window)
extends Record
implements RateLimitDecision
The event was admitted; the caller proceeds.
-
Nested Class Summary
Nested classes/interfaces inherited from interface RateLimitDecision
RateLimitDecision.Allowed, RateLimitDecision.ThrottledModifier and TypeInterfaceDescriptionstatic final recordThe event was admitted; the caller proceeds.static final recordThe event was refused — the per-window count is already at or above the configured limit. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.intReturns the value of theeventsInWindowrecord component.final inthashCode()Returns a hash code value for this object.intlimit()Returns the value of thelimitrecord component.final StringtoString()Returns a string representation of this record class.window()Returns the value of thewindowrecord component.
-
Constructor Details
-
Allowed
Validates the components.
-
-
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. -
eventsInWindow
public int eventsInWindow()Returns the value of theeventsInWindowrecord component.- Specified by:
eventsInWindowin interfaceRateLimitDecision- Returns:
- the value of the
eventsInWindowrecord component
-
limit
public int limit()Returns the value of thelimitrecord component.- Specified by:
limitin interfaceRateLimitDecision- Returns:
- the value of the
limitrecord component
-
window
Returns the value of thewindowrecord component.- Specified by:
windowin interfaceRateLimitDecision- Returns:
- the value of the
windowrecord component
-