Search in sources :

Example 1 with ClosureMetaClass

use of org.codehaus.groovy.runtime.metaclass.ClosureMetaClass in project groovy by apache.

the class Selector method getMetaClassImpl.

/**
     * Returns the MetaClassImpl if the given MetaClass is one of
     * MetaClassImpl, AdaptingMetaClass or ClosureMetaClass. If
     * none of these cases matches, this method returns null.
     */
private static MetaClassImpl getMetaClassImpl(MetaClass mc, boolean includeEMC) {
    Class mcc = mc.getClass();
    boolean valid = mcc == MetaClassImpl.class || mcc == AdaptingMetaClass.class || mcc == ClosureMetaClass.class || (includeEMC && mcc == ExpandoMetaClass.class);
    if (!valid) {
        if (LOG_ENABLED)
            LOG.info("meta class is neither MetaClassImpl, nor AdoptingMetaClass, nor ClosureMetaClass, normal method selection path disabled.");
        return null;
    }
    if (LOG_ENABLED)
        LOG.info("meta class is a recognized MetaClassImpl");
    return (MetaClassImpl) mc;
}
Also used : CachedSAMClass(org.codehaus.groovy.reflection.stdclasses.CachedSAMClass) AdaptingMetaClass(groovy.lang.AdaptingMetaClass) ExpandoMetaClass(groovy.lang.ExpandoMetaClass) ClosureMetaClass(org.codehaus.groovy.runtime.metaclass.ClosureMetaClass) MetaClass(groovy.lang.MetaClass) ExpandoMetaClass(groovy.lang.ExpandoMetaClass) MetaClassImpl(groovy.lang.MetaClassImpl) AdaptingMetaClass(groovy.lang.AdaptingMetaClass)

Example 2 with ClosureMetaClass

use of org.codehaus.groovy.runtime.metaclass.ClosureMetaClass in project groovy-core by groovy.

the class Selector method getMetaClassImpl.

/**
 * Returns the MetaClassImpl if the given MetaClass is one of
 * MetaClassImpl, AdaptingMetaClass or ClosureMetaClass. If
 * none of these cases matches, this method returns null.
 */
private static MetaClassImpl getMetaClassImpl(MetaClass mc, boolean includeEMC) {
    Class mcc = mc.getClass();
    boolean valid = mcc == MetaClassImpl.class || mcc == AdaptingMetaClass.class || mcc == ClosureMetaClass.class || (includeEMC && mcc == ExpandoMetaClass.class);
    if (!valid) {
        if (LOG_ENABLED)
            LOG.info("meta class is neither MetaClassImpl, nor AdoptingMetaClass, nor ClosureMetaClass, normal method selection path disabled.");
        return null;
    }
    if (LOG_ENABLED)
        LOG.info("meta class is a recognized MetaClassImpl");
    return (MetaClassImpl) mc;
}
Also used : CachedSAMClass(org.codehaus.groovy.reflection.stdclasses.CachedSAMClass) AdaptingMetaClass(groovy.lang.AdaptingMetaClass) ExpandoMetaClass(groovy.lang.ExpandoMetaClass) ClosureMetaClass(org.codehaus.groovy.runtime.metaclass.ClosureMetaClass) MetaClass(groovy.lang.MetaClass) ExpandoMetaClass(groovy.lang.ExpandoMetaClass) MetaClassImpl(groovy.lang.MetaClassImpl) AdaptingMetaClass(groovy.lang.AdaptingMetaClass)

Aggregations

AdaptingMetaClass (groovy.lang.AdaptingMetaClass)2 ExpandoMetaClass (groovy.lang.ExpandoMetaClass)2 MetaClass (groovy.lang.MetaClass)2 MetaClassImpl (groovy.lang.MetaClassImpl)2 CachedSAMClass (org.codehaus.groovy.reflection.stdclasses.CachedSAMClass)2 ClosureMetaClass (org.codehaus.groovy.runtime.metaclass.ClosureMetaClass)2