private void installMetaClassCreationHandle ( ) { try { final Class customMetaClassHandle = Class . forName ( "groovy.runtime.metaclass.CustomMetaClassCreationHandle" ) ; final Constructor customMetaClassHandleConstructor = customMetaClassHandle . getConstructor ( ) ; this . metaClassCreationHandle = ( MetaClassCreationHandle ) customMetaClassHandleConstructor . newInstance ( ) ; } catch ( final ClassNotFoundException e ) { this . metaClassCreationHandle = new MetaClassCreationHandle ( ) ; } catch ( final Exception e ) { throw new GroovyRuntimeException ( "Could not instantiate custom Metaclass creation handle: " + e , e ) ; } }
Looks for a class called groovy . runtime . metaclass . CustomMetaClassCreationHandle and if it exists uses it as the MetaClassCreationHandle otherwise uses the default