/// <summary>
        /// Return the difference (changes, additions, but not removals) of
        /// property values between the supplied argument and the values
        /// contained in the collection.
        /// </summary>
        /// <param name="old">Another property values collection.</param>
        /// <returns>
        /// The collection of property values that are different than the supplied one.
        /// </returns>
        public IPropertyValues ChangesSince(IPropertyValues old)
        {
            MutablePropertyValues changes = new MutablePropertyValues();

            if (old == this)
            {
                return(changes);
            }
            // for each property value in this (the newer set)
            foreach (PropertyValue newProperty in propertyValuesList)
            {
                PropertyValue oldProperty = old.GetPropertyValue(newProperty.Name);
                if (oldProperty == null)
                {
                    // if there wasn't an old one, add it
                    changes.Add(newProperty);
                }
                else if (!oldProperty.Equals(newProperty))
                {
                    // it's changed
                    changes.Add(newProperty);
                }
            }
            return(changes);
        }
        /// <summary>
        /// Returns the list of <paramref name="propertyInfos"/> that are not satisfied by <paramref name="properties"/>.
        /// </summary>
        /// <returns>the filtered list. Is never <c>null</c></returns>
        public static IList <PropertyInfo> GetUnsatisfiedDependencies(IList <PropertyInfo> propertyInfos, IPropertyValues properties, DependencyCheckingMode dependencyCheck)
        {
            List <PropertyInfo> unsatisfiedDependenciesList = new List <PropertyInfo>();

            foreach (PropertyInfo property in propertyInfos)
            {
                if (property.CanWrite && properties.GetPropertyValue(property.Name) == null)
                {
                    bool isSimple    = ObjectUtils.IsSimpleProperty(property.PropertyType);
                    bool unsatisfied = (dependencyCheck == DependencyCheckingMode.All) || (isSimple && dependencyCheck == DependencyCheckingMode.Simple) ||
                                       (!isSimple && dependencyCheck == DependencyCheckingMode.Objects);
                    if (unsatisfied)
                    {
                        unsatisfiedDependenciesList.Add(property);
                    }
                }
            }
            return(unsatisfiedDependenciesList);
        }
        /// <summary>
        /// Returns the list of <paramref name="propertyInfos"/> that are not satisfied by <paramref name="properties"/>.
        /// </summary>
        /// <returns>the filtered list. Is never <c>null</c></returns>
        public static PropertyInfo[] GetUnsatisfiedDependencies(PropertyInfo[] propertyInfos, IPropertyValues properties, DependencyCheckingMode dependencyCheck)
        {
            ArrayList unsatisfiedDependenciesList = new ArrayList();

            foreach (PropertyInfo property in propertyInfos)
            {
                if (property.CanWrite && properties.GetPropertyValue(property.Name) == null)
                {
                    bool isSimple    = ObjectUtils.IsSimpleProperty(property.PropertyType);
                    bool unsatisfied = (dependencyCheck == DependencyCheckingMode.All) || (isSimple && dependencyCheck == DependencyCheckingMode.Simple) ||
                                       (!isSimple && dependencyCheck == DependencyCheckingMode.Objects);
                    if (unsatisfied)
                    {
                        unsatisfiedDependenciesList.Add(property);
                    }
                }
            }
            return((PropertyInfo[])unsatisfiedDependenciesList.ToArray(typeof(PropertyInfo)));
        }
 /// <summary>
 /// Returns the list of <paramref name="propertyInfos"/> that are not satisfied by <paramref name="properties"/>.
 /// </summary>
 /// <returns>the filtered list. Is never <c>null</c></returns>
 public static IList<PropertyInfo> GetUnsatisfiedDependencies(IList<PropertyInfo> propertyInfos, IPropertyValues properties, DependencyCheckingMode dependencyCheck)
 {
     List<PropertyInfo> unsatisfiedDependenciesList = new List<PropertyInfo>();
     foreach (PropertyInfo property in propertyInfos)
     {
         if (property.CanWrite && properties.GetPropertyValue(property.Name) == null)
         {
             bool isSimple = ObjectUtils.IsSimpleProperty(property.PropertyType);
             bool unsatisfied = (dependencyCheck == DependencyCheckingMode.All) || (isSimple && dependencyCheck == DependencyCheckingMode.Simple)
                                || (!isSimple && dependencyCheck == DependencyCheckingMode.Objects);
             if (unsatisfied)
             {
                 unsatisfiedDependenciesList.Add(property);
             }
         }
     }
     return unsatisfiedDependenciesList;
 }
 /// <summary>
 /// Returns the list of <paramref name="propertyInfos"/> that are not satisfied by <paramref name="properties"/>.
 /// </summary>
 /// <returns>the filtered list. Is never <c>null</c></returns>
 public static PropertyInfo[] GetUnsatisfiedDependencies(PropertyInfo[] propertyInfos, IPropertyValues properties, DependencyCheckingMode dependencyCheck)
 {
     ArrayList unsatisfiedDependenciesList = new ArrayList();
     foreach (PropertyInfo property in propertyInfos)
     {
         if (property.CanWrite && properties.GetPropertyValue(property.Name) == null)
         {
             bool isSimple = ObjectUtils.IsSimpleProperty(property.PropertyType);
             bool unsatisfied = (dependencyCheck == DependencyCheckingMode.All) || (isSimple && dependencyCheck == DependencyCheckingMode.Simple)
                                || (!isSimple && dependencyCheck == DependencyCheckingMode.Objects);
             if (unsatisfied)
             {
                 unsatisfiedDependenciesList.Add(property);
             }
         }
     }
     return (PropertyInfo[])unsatisfiedDependenciesList.ToArray(typeof(PropertyInfo));
 }
 /// <summary>
 /// Return the difference (changes, additions, but not removals) of
 /// property values between the supplied argument and the values
 /// contained in the collection.
 /// </summary>
 /// <param name="old">Another property values collection.</param>
 /// <returns>
 /// The collection of property values that are different than the supplied one.
 /// </returns>
 public IPropertyValues ChangesSince(IPropertyValues old)
 {
     MutablePropertyValues changes = new MutablePropertyValues ();
     if (old == this)
     {
         return changes;
     }
     // for each property value in this (the newer set)
     foreach (PropertyValue newProperty in propertyValuesList)
     {
         PropertyValue oldProperty = old.GetPropertyValue (newProperty.Name);
         if (oldProperty == null)
         {
             // if there wasn't an old one, add it
             changes.Add (newProperty);
         }
         else if (!oldProperty.Equals (newProperty))
         {
             // it's changed
             changes.Add (newProperty);
         }
     }
     return changes;
 }