public MetaProperty createStaticVersion() { boolean mf = field==null || field.isStatic(); boolean mg = getter==null || getter.isStatic(); if (mf && mg) return this; if (mg) { MultipleSetterProperty newMsp = new MultipleSetterProperty(name); newMsp.setGetter(getter); return newMsp; } else if (mf) { MultipleSetterProperty newMsp = new MultipleSetterProperty(name); newMsp.setField(field); return newMsp; } return null; } }
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 { continue; // ignore all other types } staticPropertyIndex.put(entry.getKey(), mp); } }
boolean field = metaField == null || metaField.isStatic();
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); }
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); }
public synchronized void setStaticMetaClassField(MetaClass mc) { if (staticMetaClassField == NONE) return; if (staticMetaClassField == null) { final CachedField[] cachedFields = getFields(); for (int i = 0; i < cachedFields.length; i++) { CachedField cachedField = cachedFields[i]; if (cachedField.getName().startsWith("$staticMetaClass") && cachedField.getType() == MetaClass.class && cachedField.isStatic()) { staticMetaClassField = cachedField; break; } } } if (staticMetaClassField == null) { staticMetaClassField = NONE; return; } ((CachedField)staticMetaClassField).setProperty(null,mc); }
continue; if(mbp.getField().isStatic()){ continue;
continue; if(mbp.getField().isStatic()){ continue;
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 { continue; // ignore all other types } staticPropertyIndex.put(entry.getKey(), mp); } }
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 { continue; // ignore all other types } staticPropertyIndex.put(entry.getKey(), mp); } }
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 { continue; // ignore all other types } staticPropertyIndex.put(entry.getKey(), mp); } }
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 { continue; // ignore all other types } staticPropertyIndex.put(entry.getKey(), mp); } }
boolean field = metaField == null || metaField.isStatic();
boolean field = metaField == null || metaField.isStatic();
boolean field = metaField == null || metaField.isStatic();
boolean field = metaField == null || metaField.isStatic();