Module bus.limiter

Class MethodManager

java.lang.Object
org.miaixz.bus.limiter.metric.MethodManager

public class MethodManager extends Object
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 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 - A Pair containing the StrategyMode and the Annotation associated with the method.
    • getAnnoInfo

      public 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.
      Parameters:
      name - The name of the method to retrieve information for.
      Returns:
      A Pair containing the StrategyMode and the Annotation associated with the method, or null if no information is found.
    • contain

      public static boolean contain(String name)
      Checks if the manager contains information for a specific method name.
      Parameters:
      name - The name of the method to check.
      Returns:
      true if the method is registered, false otherwise.