T - The resolved type.@HashCodeAndEqualsPlugin.Enhance public class JavaDispatcher<T> extends Object implements PrivilegedAction<T>
A dispatcher for creating a proxy that invokes methods of a type that is possibly unknown on the current VM. Dispatchers do not use any of Byte Buddy's regular infrastructure, to avoid bootstrapping issues as these dispatchers are used by Byte Buddy itself.
 By default, this dispatcher uses the Java Proxy for creating dispatchers. By setting net.bytebuddy.generate to
 true, Byte Buddy can generate proxies manually as byte code to mostly avoid reflection and boxing of arguments as arrays.
 
 If a security manager is active, the net.bytebuddy.createJavaDispatcher runtime permission is required. Any dispatching
 will be executed from a separate class loader and an unnamed module but with the ProtectionDomain of
 the JavaDispatcher class. It is not permitted to invoke methods of the java.security.AccessController class or
 to resolve a java.lang.invoke.MethodHandle$Lookup.
 
| Modifier and Type | Class and Description | 
|---|---|
| static interface  | JavaDispatcher.ContainerIndicates that the method is supposed to return an array of the proxied type. | 
| static interface  | JavaDispatcher.DefaultsIndicates that a method is supposed to return a default value if a method or type could not be resolved. | 
| protected static interface  | JavaDispatcher.DispatcherA dispatcher for handling a proxied method. | 
| protected static class  | JavaDispatcher.DynamicClassLoaderA class loader for loading synthetic classes for implementing a  JavaDispatcher. | 
| static interface  | JavaDispatcher.InstanceIndicates that a method is supposed to perform an instance check. | 
| static interface  | JavaDispatcher.IsConstructorIndicates that a proxied method is a constructor. | 
| static interface  | JavaDispatcher.IsStaticIndicates that a proxied method is static. | 
| static interface  | JavaDispatcher.ProxiedIndicates a proxied type's name. | 
| protected static class  | JavaDispatcher.ProxiedInvocationHandlerAn invocation handler that invokes given dispatchers. | 
| Modifier and Type | Field and Description | 
|---|---|
| static String | GENERATE_PROPERTYA property to determine, that if  true, dispatcher classes will be generated natively and not by using aProxy. | 
| Modifier | Constructor and Description | 
|---|---|
| protected  | JavaDispatcher(Class<T> proxy,
              ClassLoader classLoader,
              boolean generate)Creates a new dispatcher. | 
| Modifier and Type | Method and Description | 
|---|---|
| static <T> PrivilegedAction<T> | of(Class<T> type)Resolves an action for creating a dispatcher for the provided type where the proxied type is resolved from the bootstrap loader. | 
| static <T> PrivilegedAction<T> | of(Class<T> type,
  ClassLoader classLoader)Resolves an action for creating a dispatcher for the provided type. | 
| protected static <T> PrivilegedAction<T> | of(Class<T> type,
  ClassLoader classLoader,
  boolean generate)Resolves an action for creating a dispatcher for the provided type. | 
| T | run() | 
public static final String GENERATE_PROPERTY
true, dispatcher classes will be generated natively and not by using a Proxy.protected JavaDispatcher(Class<T> proxy, @MaybeNull ClassLoader classLoader, boolean generate)
proxy - The proxy type.classLoader - The class loader to resolve the proxied type from or null if the bootstrap loader should be used.generate - true if a proxy class should be manually generated.public static <T> PrivilegedAction<T> of(Class<T> type)
T - The resolved type.type - The type for which a dispatcher should be resolved.public static <T> PrivilegedAction<T> of(Class<T> type, @MaybeNull ClassLoader classLoader)
T - The resolved type.type - The type for which a dispatcher should be resolved.classLoader - The class loader to resolve the proxied type from.protected static <T> PrivilegedAction<T> of(Class<T> type, @MaybeNull ClassLoader classLoader, boolean generate)
T - The resolved type.type - The type for which a dispatcher should be resolved.classLoader - The class loader to resolve the proxied type from.generate - true if a proxy class should be manually generated.public T run()
run in interface PrivilegedAction<T>Copyright © 2014–2025. All rights reserved.