java.lang.Object
org.miaixz.bus.limiter.Supplier
Abstract base class for a supplier that provides a unique identifier for a user or request. This supplier is used in
limiting scenarios to identify the entity being limited. It also provides a default interception message for blocked
requests.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Serializableget()Retrieves the current user or request identifier.Provides a default interception message when a request is blocked by a limiter.
-
Constructor Details
-
Supplier
public Supplier()
-
-
Method Details
-
get
Retrieves the current user or request identifier. This method must be implemented by concrete subclasses to provide the specific identification logic.- Returns:
- A
Serializableobject representing the user or request identifier.
-
intercept
Provides a default interception message when a request is blocked by a limiter. Subclasses can override this method to provide custom messages or actions upon interception.- Parameters:
bean- The target object on which the method was invoked.method- TheMethodthat was attempted to be executed.args- The arguments passed to the method invocation.- Returns:
- A
Serializableobject, typically a message, indicating the request was intercepted.
-