use of org.codehaus.groovy.util.SingleKeyHashMap in project groovy-core by groovy.
the class MetaClassImpl method inheritFields.
private void inheritFields(LinkedList<CachedClass> superClasses) {
SingleKeyHashMap last = null;
for (CachedClass klass : superClasses) {
SingleKeyHashMap propertyIndex = classPropertyIndex.getNotNull(klass);
if (last != null) {
copyNonPrivateFields(last, propertyIndex);
}
last = propertyIndex;
addFields(klass, propertyIndex);
}
}
use of org.codehaus.groovy.util.SingleKeyHashMap in project groovy-core by groovy.
the class MetaClassImpl method inheritStaticInterfaceFields.
private void inheritStaticInterfaceFields(LinkedList superClasses, Set interfaces) {
for (Iterator interfaceIter = interfaces.iterator(); interfaceIter.hasNext(); ) {
CachedClass iclass = (CachedClass) interfaceIter.next();
SingleKeyHashMap iPropertyIndex = classPropertyIndex.getNotNull(iclass);
addFields(iclass, iPropertyIndex);
for (Iterator classIter = superClasses.iterator(); classIter.hasNext(); ) {
CachedClass sclass = (CachedClass) classIter.next();
if (!iclass.getTheClass().isAssignableFrom(sclass.getTheClass()))
continue;
SingleKeyHashMap sPropertyIndex = classPropertyIndex.getNotNull(sclass);
copyNonPrivateFields(iPropertyIndex, sPropertyIndex);
}
}
}
use of org.codehaus.groovy.util.SingleKeyHashMap in project groovy-core by groovy.
the class MetaClassImpl method copyClassPropertyIndexForSuper.
private void copyClassPropertyIndexForSuper(Index dest) {
for (ComplexKeyHashMap.EntryIterator iter = classPropertyIndex.getEntrySetIterator(); iter.hasNext(); ) {
SingleKeyHashMap.Entry entry = (SingleKeyHashMap.Entry) iter.next();
SingleKeyHashMap newVal = new SingleKeyHashMap();
dest.put((CachedClass) entry.getKey(), newVal);
}
}
use of org.codehaus.groovy.util.SingleKeyHashMap in project groovy by apache.
the class MetaClassImpl method addMetaBeanProperty.
/**
* Adds a new MetaBeanProperty to this MetaClass
*
* @param mp The MetaBeanProperty
*/
public void addMetaBeanProperty(MetaBeanProperty mp) {
MetaProperty staticProperty = establishStaticMetaProperty(mp);
if (staticProperty != null) {
staticPropertyIndex.put(mp.getName(), mp);
} else {
SingleKeyHashMap propertyMap = classPropertyIndex.getNotNull(theCachedClass);
//keep field
CachedField field;
MetaProperty old = (MetaProperty) propertyMap.get(mp.getName());
if (old != null) {
if (old instanceof MetaBeanProperty) {
field = ((MetaBeanProperty) old).getField();
} else if (old instanceof MultipleSetterProperty) {
field = ((MultipleSetterProperty) old).getField();
} else {
field = (CachedField) old;
}
mp.setField(field);
}
// put it in the list
// this will overwrite a possible field property
propertyMap.put(mp.getName(), mp);
}
}
use of org.codehaus.groovy.util.SingleKeyHashMap in project groovy by apache.
the class MetaClassImpl method inheritFields.
private void inheritFields(LinkedList<CachedClass> superClasses) {
SingleKeyHashMap last = null;
for (CachedClass klass : superClasses) {
SingleKeyHashMap propertyIndex = classPropertyIndex.getNotNull(klass);
if (last != null) {
copyNonPrivateFields(last, propertyIndex, klass);
}
last = propertyIndex;
addFields(klass, propertyIndex);
}
}
Aggregations