Search in sources :

Example 1 with MetaClassDescriptor

use of eu.esdihumboldt.util.groovy.meta.extension.MetaClassDescriptor in project hale by halestudio.

the class CustomMetaClassCreationHandle method createNormalMetaClass.

@Override
protected MetaClass createNormalMetaClass(@SuppressWarnings("rawtypes") Class theClass, MetaClassRegistry registry) {
    MetaClass metaClass = super.createNormalMetaClass(theClass, registry);
    for (MetaClassDescriptor descriptor : ext.getElements()) {
        if (descriptorApplies(descriptor, theClass)) {
            // create meta class
            Class<?> delegatingMetaClass = descriptor.getMetaClass();
            try {
                Constructor<?> constructor = delegatingMetaClass.getConstructor(MetaClass.class);
                metaClass = (MetaClass) constructor.newInstance(metaClass);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    return metaClass;
}
Also used : MetaClass(groovy.lang.MetaClass) MetaClassDescriptor(eu.esdihumboldt.util.groovy.meta.extension.MetaClassDescriptor)

Aggregations

MetaClassDescriptor (eu.esdihumboldt.util.groovy.meta.extension.MetaClassDescriptor)1 MetaClass (groovy.lang.MetaClass)1