java.lang.Object
org.miaixz.bus.limiter.Builder
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Class<?> getUserClass(Class<?> clazz) Retrieves the actual user class from a given class, handling CGLIB proxies.static StringresolveMethodName(Method method) Resolves and caches a unique string representation for the given method.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
getUserClass
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
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 isnull.
-