use of org.codehaus.groovy.runtime.metaclass.MethodMetaProperty in project groovity by disney.
the class MetaPropertyLookup method getSettableMetaProperty.
public static final MetaProperty getSettableMetaProperty(Object o, String name) {
final Class<?> c = o.getClass();
ConcurrentHashMap<String, MetaProperty> properties = singlePropertyCache.get(c);
if (properties == null) {
MetaClass mc = GroovySystem.getMetaClassRegistry().getMetaClass(c);
List<MetaProperty> mps = mc.getProperties();
properties = new ConcurrentHashMap<>();
for (MetaProperty mp : mps) {
if (mp instanceof MetaBeanProperty) {
MetaBeanProperty mbp = ((MetaBeanProperty) mp);
if (mbp.getSetter() == null) {
CachedField cf = mbp.getField();
if (cf == null || cf.isFinal() || cf.isStatic()) {
continue;
}
}
} else if (mp instanceof MethodMetaProperty) {
continue;
}
properties.put(mp.getName(), mp);
}
singlePropertyCache.putIfAbsent(c, properties);
}
return properties.get(name);
}
Aggregations