Interface GeneratedMetaMethod.ProxyFactory

Enclosing class:
GeneratedMetaMethod

public static interface GeneratedMetaMethod.ProxyFactory
Creates the generated DGM adapter for a GeneratedMetaMethod.DgmMethodRecord by its index, with a direct constructor call rather than reflection.

The one implementation, org.codehaus.groovy.runtime.DgmProxyFactory, is generated by DgmConverter alongside the adapters themselves, so that the adapters are reachable through ordinary static analysis (GraalVM native image needs no reflection metadata for them) and their first use costs a switch and a constructor call rather than a class lookup and a reflective instantiation. That class registers itself with GeneratedMetaMethod.Proxy.register(ProxyFactory) when it is initialised. DgmProxyFactoryConfig switches the factory off in favour of the reflective path.

Since:
6.0.0
  • Method Details

    • create

      MetaMethod create(int index, String name, CachedClass declaringClass, Class returnType, Class[] parameters)
      Returns:
      a new adapter for the record at index, or null if the index is out of range