/// <summary> /// Extract a filtered set of PropertyInfos from the given IObjectWrapper, excluding /// ignored dependency types. /// </summary> /// <param name="wrapper">The object wrapper the object was created with.</param> /// <returns>The filtered PropertyInfos</returns> private PropertyInfo[] FilterPropertyInfoForDependencyCheck(IObjectWrapper wrapper) { lock (filteredPropertyDescriptorsCache) { PropertyInfo[] filtered = (PropertyInfo[])filteredPropertyDescriptorsCache[wrapper.WrappedType]; if (filtered == null) { ArrayList list = new ArrayList(wrapper.GetPropertyInfos()); for (int i = list.Count - 1; i >= 0; i--) { PropertyInfo pi = (PropertyInfo)list[i]; if (IsExcludedFromDependencyCheck(pi)) { list.RemoveAt(i); } } filtered = (PropertyInfo[])list.ToArray(typeof(PropertyInfo)); filteredPropertyDescriptorsCache.Add(wrapper.WrappedType, filtered); } return filtered; } }
/// <summary> /// Return an array of object-type property names that are unsatisfied. /// </summary> /// <remarks> /// <p> /// These are probably unsatisfied references to other objects in the /// factory. Does not include simple properties like primitives or /// <see cref="System.String"/>s. /// </p> /// </remarks> /// <returns> /// An array of object-type property names that are unsatisfied. /// </returns> /// <param name="definition"> /// The definition of the named object. /// </param> /// <param name="wrapper"> /// The <see cref="Spring.Objects.IObjectWrapper"/> wrapping the target object. /// </param> protected string[] UnsatisfiedNonSimpleProperties(RootObjectDefinition definition, IObjectWrapper wrapper) { ListSet results = new ListSet(); IPropertyValues pvs = definition.PropertyValues; PropertyInfo[] properties = wrapper.GetPropertyInfos(); foreach (PropertyInfo property in properties) { string name = property.Name; if (property.CanWrite && !IsExcludedFromDependencyCheck(property) && !pvs.Contains(name) && !ObjectUtils.IsSimpleProperty(property.PropertyType)) { results.Add(name); } } return (string[])CollectionUtils.ToArray(results, typeof(string)); }
/// <summary> /// Extract a filtered set of PropertyInfos from the given IObjectWrapper, excluding /// ignored dependency types. /// </summary> /// <param name="wrapper">The object wrapper the object was created with.</param> /// <returns>The filtered PropertyInfos</returns> private IList<PropertyInfo> FilterPropertyInfoForDependencyCheck(IObjectWrapper wrapper) { lock (filteredPropertyDescriptorsCache) { IList<PropertyInfo> filtered; if (!filteredPropertyDescriptorsCache.TryGetValue(wrapper.WrappedType, out filtered)) { List<PropertyInfo> list = new List<PropertyInfo>(wrapper.GetPropertyInfos()); for (int i = list.Count - 1; i >= 0; i--) { PropertyInfo pi = list[i]; if (IsExcludedFromDependencyCheck(pi)) { list.RemoveAt(i); } } filtered = list; filteredPropertyDescriptorsCache.Add(wrapper.WrappedType, filtered); } return filtered; } }