public void add(ImplicitCollectionMappingImpl def) { fieldNameToDef.put(def.getFieldName(), def); namedItemTypeToDef.put(def.createNamedItemType(), def); if (def.getItemFieldName() != null) { itemFieldNameToDef.put(def.getItemFieldName(), def); } }
public Class getItemTypeForItemFieldName(String itemFieldName) { ImplicitCollectionMappingImpl def = getImplicitCollectionDefByItemFieldName(itemFieldName); if (def != null) { return def.getItemType(); } else { ImplicitCollectionMapperForClass mapper = ImplicitCollectionMapper.this.getMapper(definedIn.getSuperclass()); return mapper != null ? mapper.getItemTypeForItemFieldName(itemFieldName) : null; } }
public String getFieldNameForItemTypeAndName(Class itemType, String itemFieldName) { ImplicitCollectionMappingImpl unnamed = null; for (Iterator iterator = namedItemTypeToDef.keySet().iterator(); iterator.hasNext(); ) { NamedItemType itemTypeForFieldName = (NamedItemType) iterator.next(); ImplicitCollectionMappingImpl def = (ImplicitCollectionMappingImpl) namedItemTypeToDef.get(itemTypeForFieldName); if (itemType == Mapper.Null.class) { unnamed = def; break; } else if (itemTypeForFieldName.itemType.isAssignableFrom(itemType)) { if (def.getItemFieldName() != null) { if (def.getItemFieldName().equals(itemFieldName)) { return def.getFieldName(); } } else { unnamed = def; if (itemFieldName == null) { break; } } } } if (unnamed != null) { return unnamed.getFieldName(); } else { ImplicitCollectionMapperForClass mapper = ImplicitCollectionMapper.this.getMapper(definedIn.getSuperclass()); return mapper != null ? mapper.getFieldNameForItemTypeAndName(itemType, itemFieldName) : null; } }