Overview
TheRateLimitContext interface provides invocation context used by the starter to resolve which policy to enforce and which key/bucket to charge. It is intentionally framework-agnostic so the same API can be used by AOP, servlet filters, reactive interceptors, etc.
Package: io.github.v4runsharma.ratelimiter.core
Source: RateLimitContext.java:15
Methods
getAnnotation
@RateLimit annotation for this invocation. Used to read declared defaults such as limit/window, name, enabled flag, etc.
Returns: The RateLimit annotation
Source: RateLimitContext.java:21
getTargetClass
RateLimitContext.java:27
getMethod
RateLimitContext.java:33
getArguments
RateLimitContext.java:39
getTarget
null for static methods). Useful when a resolver needs instance state or to detect proxy details.
Returns: The target object instance or null
Source: RateLimitContext.java:45
Usage example
Custom key resolvers use the context to extract information:Implementation
The default implementationDefaultRateLimitContext is provided by the starter and populated by the AOP aspect (RateLimitAspect). Users typically don’t need to implement this interface directly.
Related
- RateLimitKeyResolver - Uses context to resolve keys
- RateLimitPolicyProvider - Uses context to resolve policies
- RateLimitEnforcer - Orchestrates context-based rate limiting