java.lang.Object
org.miaixz.bus.limiter.metric.MethodManager
Manages the mapping between method names and their associated limiting strategy and annotation information. This
class provides a centralized registry for methods that are subject to limiting rules, allowing for quick retrieval of
their configured strategy and annotation details.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddMethod(String name, org.miaixz.bus.core.lang.tuple.Pair<StrategyMode, Annotation> pair) Adds a method and its associated limiting strategy and annotation to the manager.static booleanChecks if the manager contains information for a specific method name.static org.miaixz.bus.core.lang.tuple.Pair<StrategyMode, Annotation> getAnnoInfo(String name) Retrieves the limiting strategy and annotation information for a given method name.
-
Constructor Details
-
MethodManager
public MethodManager()
-
-
Method Details
-
addMethod
public static void addMethod(String name, org.miaixz.bus.core.lang.tuple.Pair<StrategyMode, Annotation> pair) Adds a method and its associated limiting strategy and annotation to the manager. This method logs the registration of the method for auditing purposes.- Parameters:
name- The unique name of the method to be registered.pair- APaircontaining theStrategyModeand theAnnotationassociated with the method.
-
getAnnoInfo
Retrieves the limiting strategy and annotation information for a given method name.- Parameters:
name- The name of the method to retrieve information for.- Returns:
- A
Paircontaining theStrategyModeand theAnnotationassociated with the method, ornullif no information is found.
-
contain
Checks if the manager contains information for a specific method name.- Parameters:
name- The name of the method to check.- Returns:
trueif the method is registered,falseotherwise.
-