Module bus.limiter

Class Builder

java.lang.Object
org.miaixz.bus.limiter.Builder

public class Builder extends Object
Utility class for building and resolving information related to method calls and classes. This class provides methods to extract the real user class from a potentially proxied class and to generate a unique string representation for a given method.
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • getUserClass

      public static Class<?> getUserClass(Class<?> clazz)
      Retrieves the actual user class from a given class, handling CGLIB proxies. If the provided class is a CGLIB proxy, it recursively gets the superclass until the non-proxied user class is found.
      Parameters:
      clazz - The class to inspect.
      Returns:
      The actual user class, or the original class if it's not a CGLIB proxy.
    • resolveMethodName

      public static String resolveMethodName(Method method)
      Resolves and caches a unique string representation for the given method. The method name is constructed using the declaring class's name, the method's name, and the canonical names of its parameter types. This string is then cached to avoid repeated computation.
      Parameters:
      method - The method instance for which to resolve the name.
      Returns:
      A unique string representation of the method.
      Throws:
      IllegalArgumentException - if the provided method is null.