java.lang.Object
org.miaixz.bus.limiter.proxy.ByteBuddyProxy
A utility class for creating ByteBuddy proxies to intercept method calls. This class generates a subclass of a given
original class and intercepts all its methods using a
ByteBuddyHandler to apply limiting rules.- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionByteBuddyProxy(Object bean, Class<?> originalClazz) Constructs a newByteBuddyProxywith the specified target bean and its original class. -
Method Summary
-
Field Details
-
bean
The target object (bean) for which the proxy is being created. Method calls on the proxy will be delegated to this bean.
-
-
Constructor Details
-
ByteBuddyProxy
Constructs a newByteBuddyProxywith the specified target bean and its original class.- Parameters:
bean- The target object to be proxied.originalClazz- The original class of the target object.
-
-
Method Details
-
proxy
Creates and returns a ByteBuddy proxy instance for thebean. The proxy intercepts all method calls and delegates them to aByteBuddyHandlerfor applying limiting logic.- Returns:
- A proxied instance of the original class.
- Throws:
Exception- if an error occurs during proxy creation.
-