Search in sources :

Example 1 with MetaClassRegistryChangeEventListener

use of groovy.lang.MetaClassRegistryChangeEventListener in project grails-core by grails.

the class MetaClassRegistryCleaner method createAndRegister.

public static MetaClassRegistryCleaner createAndRegister() {
    MetaClassRegistry metaClassRegistry = GroovySystem.getMetaClassRegistry();
    MetaClassRegistryChangeEventListener[] listeners = metaClassRegistry.getMetaClassRegistryChangeEventListeners();
    boolean registered = false;
    for (MetaClassRegistryChangeEventListener listener : listeners) {
        if (listener == INSTANCE) {
            registered = true;
            break;
        }
    }
    if (!registered) {
        GroovySystem.getMetaClassRegistry().addMetaClassRegistryChangeEventListener(INSTANCE);
    }
    return INSTANCE;
}
Also used : MetaClassRegistry(groovy.lang.MetaClassRegistry) MetaClassRegistryChangeEventListener(groovy.lang.MetaClassRegistryChangeEventListener)

Aggregations

MetaClassRegistry (groovy.lang.MetaClassRegistry)1 MetaClassRegistryChangeEventListener (groovy.lang.MetaClassRegistryChangeEventListener)1