Class DgmProxyFactoryConfig

java.lang.Object
org.codehaus.groovy.reflection.DgmProxyFactoryConfig

public final class DgmProxyFactoryConfig extends Object
The groovy.dgm.factory switch: whether GeneratedMetaMethod.Proxy creates DGM adapters through the generated DgmProxyFactory (the default) or resolves them by class name with reflection.

This class holds nothing but that flag, read once from the system property, so that a GraalVM native image can initialise it at build time (the shipped native-image.properties does so). The flag is then a constant to the image builder: with the default, every adapter is reachable through the factory and needs no reflection metadata; with -Dgroovy.dgm.factory=false passed to native-image, the factory and every adapter the native-image agent did not record are left out of the image, which is smaller but fails at run time on any DGM method the agent run did not exercise.

On a JVM the property is read once at start-up and only chooses between the two ways of creating an adapter the first time it is used; it has no effect on calls after that.

Since:
6.0.0
  • Field Details

    • PROPERTY

      public static final String PROPERTY
      The system property; absent or anything but false enables the factory.
      See Also:
    • ENABLED

      public static final boolean ENABLED
      Whether adapters are created through the generated factory.