Search in sources :

Example 6 with MultipleSetterProperty

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

the class MetaClassImpl method makeStaticPropertyIndex.

private void makeStaticPropertyIndex() {
    SingleKeyHashMap propertyMap = classPropertyIndex.getNotNull(theCachedClass);
    for (ComplexKeyHashMap.EntryIterator iter = propertyMap.getEntrySetIterator(); iter.hasNext(); ) {
        SingleKeyHashMap.Entry entry = ((SingleKeyHashMap.Entry) iter.next());
        MetaProperty mp = (MetaProperty) entry.getValue();
        if (mp instanceof CachedField) {
            CachedField mfp = (CachedField) mp;
            if (!mfp.isStatic())
                continue;
        } else if (mp instanceof MetaBeanProperty) {
            MetaProperty result = establishStaticMetaProperty(mp);
            if (result == null)
                continue;
            else {
                mp = result;
            }
        } else if (mp instanceof MultipleSetterProperty) {
            MultipleSetterProperty msp = (MultipleSetterProperty) mp;
            mp = msp.createStaticVersion();
        } else {
            // ignore all other types
            continue;
        }
        staticPropertyIndex.put(entry.getKey(), mp);
    }
}
Also used : SingleKeyHashMap(org.codehaus.groovy.util.SingleKeyHashMap) MultipleSetterProperty(org.codehaus.groovy.runtime.metaclass.MultipleSetterProperty) ComplexKeyHashMap(org.codehaus.groovy.util.ComplexKeyHashMap) GetMethodMetaProperty(org.codehaus.groovy.runtime.metaclass.MethodMetaProperty.GetMethodMetaProperty) GetBeanMethodMetaProperty(org.codehaus.groovy.runtime.metaclass.MethodMetaProperty.GetBeanMethodMetaProperty) CachedField(org.codehaus.groovy.reflection.CachedField)

Aggregations

CachedField (org.codehaus.groovy.reflection.CachedField)6 MultipleSetterProperty (org.codehaus.groovy.runtime.metaclass.MultipleSetterProperty)6 GetBeanMethodMetaProperty (org.codehaus.groovy.runtime.metaclass.MethodMetaProperty.GetBeanMethodMetaProperty)4 GetMethodMetaProperty (org.codehaus.groovy.runtime.metaclass.MethodMetaProperty.GetMethodMetaProperty)4 SingleKeyHashMap (org.codehaus.groovy.util.SingleKeyHashMap)4 GroovyBugError (org.codehaus.groovy.GroovyBugError)2 ComplexKeyHashMap (org.codehaus.groovy.util.ComplexKeyHashMap)2