Changing from arrays to IList, generify AOP API, change GetObjectsOfType<T> to GetObjects<T> and GetObjectNamesForType<T> to GetObjectNames<T>
This commit is contained in:
@@ -47,7 +47,7 @@ namespace Spring.AopQuickStart
|
||||
{
|
||||
// Create AOP proxy using Spring.NET IoC container.
|
||||
IApplicationContext ctx = ContextRegistry.GetContext();
|
||||
IDictionary<string, ICommand> commands = ctx.GetObjectsOfType<ICommand>();
|
||||
IDictionary<string, ICommand> commands = ctx.GetObjects<ICommand>();
|
||||
|
||||
foreach (ICommand command in commands.Values)
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Spring.TxQuickStart
|
||||
NamespaceParserRegistry.RegisterParser(typeof(TxNamespaceParser));
|
||||
NamespaceParserRegistry.RegisterParser(typeof(AopNamespaceParser));
|
||||
IApplicationContext context = CreateContextFromXml();
|
||||
IDictionary<string, IAccountManager> dict = context.GetObjectsOfType<IAccountManager>();
|
||||
IDictionary<string, IAccountManager> dict = context.GetObjects<IAccountManager>();
|
||||
accountManager = context["accountManager"] as IAccountManager;
|
||||
CleanDb(context);
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ namespace Spring.Aop.Framework
|
||||
{
|
||||
StringBuilder buffer = new StringBuilder("Invocation: method '");
|
||||
buffer.Append(Method.Name).Append("', ").Append("arguments ");
|
||||
buffer.Append(this.arguments != null ? StringUtils.ArrayToCommaDelimitedString(this.arguments) : "[none]");
|
||||
buffer.Append(this.arguments != null ? StringUtils.CollectionToCommaDelimitedString(this.arguments) : "[none]");
|
||||
buffer.Append("; ");
|
||||
if (this.target == null)
|
||||
{
|
||||
|
||||
@@ -294,7 +294,7 @@ namespace Spring.Aop.Framework
|
||||
/// to be (or that are being) proxied by this proxy.
|
||||
/// </value>
|
||||
/// <seealso cref="Spring.Aop.Framework.IAdvised.Interfaces"/>
|
||||
public virtual Type[] Interfaces
|
||||
public virtual IList<Type> Interfaces
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -318,12 +318,12 @@ namespace Spring.Aop.Framework
|
||||
/// <summary>
|
||||
/// Set interfaces to be proxied, bypassing locking and <see cref="ProxyConfig.IsFrozen"/>
|
||||
/// </summary>
|
||||
protected void SetInterfacesInternal(Type[] value)
|
||||
protected void SetInterfacesInternal(IList<Type> value)
|
||||
{
|
||||
this.interfaceMap.Clear();
|
||||
if (value != null)
|
||||
{
|
||||
for (int i = 0; i < value.Length; i++)
|
||||
for (int i = 0; i < value.Count; i++)
|
||||
{
|
||||
AddInterfaceInternal(value[i]);
|
||||
}
|
||||
@@ -392,14 +392,9 @@ namespace Spring.Aop.Framework
|
||||
/// instances that have been applied to this proxy.
|
||||
/// </value>
|
||||
/// <seealso cref="Spring.Aop.Framework.IAdvised.Advisors"/>
|
||||
public virtual IAdvisor[] Advisors
|
||||
public virtual IList<IAdvisor> Advisors
|
||||
{
|
||||
get
|
||||
{
|
||||
{
|
||||
return _advisorsArray;
|
||||
}
|
||||
}
|
||||
get { return _advisorsArray; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -419,13 +414,13 @@ namespace Spring.Aop.Framework
|
||||
/// instances that have been applied to this proxy.
|
||||
/// </value>
|
||||
/// <seealso cref="Spring.Aop.Framework.IAdvised.Introductions"/>
|
||||
public virtual IIntroductionAdvisor[] Introductions
|
||||
public virtual IList<IIntroductionAdvisor> Introductions
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (this.SyncRoot)
|
||||
{
|
||||
return this._introductions.ToArray();
|
||||
return this._introductions;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1491,7 +1486,7 @@ namespace Spring.Aop.Framework
|
||||
/// </param>
|
||||
protected internal virtual void CopyConfigurationFrom(AdvisedSupport other)
|
||||
{
|
||||
CopyConfigurationFrom(other, other.TargetSource, new List<IAdvisor>(other.Advisors), new List<IAdvisor>(other.Introductions));
|
||||
CopyConfigurationFrom(other, other.TargetSource, new List<IAdvisor>(other.Advisors), new List<IIntroductionAdvisor>(other.Introductions));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1514,14 +1509,14 @@ namespace Spring.Aop.Framework
|
||||
/// <param name="targetSource">the new target source</param>
|
||||
/// <param name="advisors">the advisors for the chain</param>
|
||||
/// <param name="introductions">the introductions for the chain</param>
|
||||
protected internal virtual void CopyConfigurationFrom(AdvisedSupport other, ITargetSource targetSource, IList<IAdvisor> advisors, IList<IAdvisor> introductions)
|
||||
protected internal virtual void CopyConfigurationFrom(AdvisedSupport other, ITargetSource targetSource, IList<IAdvisor> advisors, IList<IIntroductionAdvisor> introductions)
|
||||
{
|
||||
CopyFrom(other);
|
||||
this.AdvisorChainFactory = other.advisorChainFactory;
|
||||
this.m_targetSource = targetSource;
|
||||
// this.cachedProxyType = other.cachedProxyType;
|
||||
// this.cachedProxyConstructor = other.cachedProxyConstructor;
|
||||
this.Interfaces = (Type[]) CollectionUtils.ToArray(other.Interfaces, typeof(Type));
|
||||
this.Interfaces = new List<Type>(other.Interfaces);
|
||||
foreach (Type intf in other.interfaceMap.Keys)
|
||||
{
|
||||
this.interfaceMap[intf] = other.interfaceMap[intf];
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Spring.Aop.Framework
|
||||
public static IList<object> CalculateInterceptors(
|
||||
IAdvised config, object proxy, MethodInfo method, Type targetType)
|
||||
{
|
||||
IList<object> interceptors = new List<object>(config.Advisors.Length);
|
||||
IList<object> interceptors = new List<object>(config.Advisors.Count);
|
||||
foreach (IAdvisor advisor in config.Advisors)
|
||||
{
|
||||
if (advisor is IPointcutAdvisor)
|
||||
|
||||
@@ -22,13 +22,14 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Common.Logging;
|
||||
|
||||
using Spring.Core;
|
||||
using Spring.Objects.Factory;
|
||||
using Spring.Objects.Factory.Config;
|
||||
using Spring.Util;
|
||||
using System.Linq;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -125,20 +126,20 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// <param name="targetType">the type of the target object</param>
|
||||
/// <param name="targetName">the name of the target object</param>
|
||||
/// <param name="customTargetSource">targetSource returned by TargetSource property:
|
||||
/// may be ignored. Will be null unless a custom target source is in use.</param>
|
||||
/// may be ignored. Will be null unless a custom target source is in use.</param>
|
||||
/// <returns>
|
||||
/// an array of additional interceptors for the particular object;
|
||||
/// or an empty array if no additional interceptors but just the common ones;
|
||||
/// or null if no proxy at all, not even with the common interceptors.
|
||||
/// </returns>
|
||||
protected override object[] GetAdvicesAndAdvisorsForObject(Type targetType, string targetName, ITargetSource customTargetSource)
|
||||
protected override IList<object> GetAdvicesAndAdvisorsForObject(Type targetType, string targetName, ITargetSource customTargetSource)
|
||||
{
|
||||
IList advisors = FindEligibleAdvisors(targetType, targetName);
|
||||
IList<IAdvisor> advisors = FindEligibleAdvisors(targetType, targetName);
|
||||
if (advisors.Count == 0)
|
||||
{
|
||||
return DO_NOT_PROXY;
|
||||
}
|
||||
return (object[]) CollectionUtils.ToArray(advisors, typeof (object));
|
||||
return advisors.Cast<object>().ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -150,10 +151,10 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// the empty list, not null, if there are no pointcuts or interceptors.
|
||||
/// The by-order sorted list of advisors otherwise
|
||||
/// </returns>
|
||||
protected IList FindEligibleAdvisors(Type targetType, string targetName)
|
||||
protected IList<IAdvisor> FindEligibleAdvisors(Type targetType, string targetName)
|
||||
{
|
||||
IList candidateAdvisors = FindCandidateAdvisors(targetType, targetName);
|
||||
IList eligibleAdvisors = FindAdvisorsThatCanApply(candidateAdvisors, targetType, targetName);
|
||||
IList<IAdvisor> candidateAdvisors = FindCandidateAdvisors(targetType, targetName);
|
||||
IList<IAdvisor> eligibleAdvisors = FindAdvisorsThatCanApply(candidateAdvisors, targetType, targetName);
|
||||
|
||||
ExtendAdvisors(eligibleAdvisors, targetType, targetName);
|
||||
eligibleAdvisors = SortAdvisors(eligibleAdvisors);
|
||||
@@ -167,7 +168,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// <param name="targetType">the type of the object to be advised</param>
|
||||
/// <param name="targetName">the name of the object to be advised</param>
|
||||
/// <returns>the list of candidate advisors</returns>
|
||||
protected virtual IList FindCandidateAdvisors(Type targetType, string targetName)
|
||||
protected virtual IList<IAdvisor> FindCandidateAdvisors(Type targetType, string targetName)
|
||||
{
|
||||
return _advisorRetrievalHelper.FindAdvisorObjects(targetType, targetName);
|
||||
}
|
||||
@@ -180,14 +181,14 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// <param name="targetType">the target object's type</param>
|
||||
/// <param name="targetName">the target object's name</param>
|
||||
/// <returns>the list of applicable advisors</returns>
|
||||
protected virtual IList FindAdvisorsThatCanApply(IList candidateAdvisors, Type targetType, string targetName)
|
||||
protected virtual IList<IAdvisor> FindAdvisorsThatCanApply(IList<IAdvisor> candidateAdvisors, Type targetType, string targetName)
|
||||
{
|
||||
if (candidateAdvisors.Count==0)
|
||||
{
|
||||
return candidateAdvisors;
|
||||
}
|
||||
|
||||
ArrayList eligibleAdvisors = new ArrayList();
|
||||
List<IAdvisor> eligibleAdvisors = new List<IAdvisor>();
|
||||
foreach(IAdvisor candidate in candidateAdvisors)
|
||||
{
|
||||
if (candidate is IIntroductionAdvisor && AopUtils.CanApply(candidate, targetType, null))
|
||||
@@ -230,14 +231,16 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// </summary>
|
||||
/// <param name="advisors">The advisors.</param>
|
||||
/// <returns></returns>
|
||||
protected virtual IList SortAdvisors(IList advisors)
|
||||
protected virtual IList<IAdvisor> SortAdvisors(IList<IAdvisor> advisors)
|
||||
{
|
||||
if (advisors.Count==0)
|
||||
{
|
||||
return advisors;
|
||||
}
|
||||
}
|
||||
|
||||
if (advisors is ArrayList)
|
||||
if (advisors is List<IAdvisor>)
|
||||
((List<IAdvisor>)advisors).Sort(new OrderComparator<IAdvisor>());
|
||||
else if (advisors is ArrayList)
|
||||
((ArrayList) advisors).Sort(new OrderComparator());
|
||||
else if (advisors is Array)
|
||||
Array.Sort((Array) advisors, new OrderComparator());
|
||||
@@ -257,7 +260,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// <param name="advisors">Advisors that have already been identified as applying to a given object</param>
|
||||
/// <param name="objectType">the type of the object to be advised</param>
|
||||
/// <param name="objectName">the name of the object to be advised</param>
|
||||
protected virtual void ExtendAdvisors(IList advisors, Type objectType, string objectName)
|
||||
protected virtual void ExtendAdvisors(IList<IAdvisor> advisors, Type objectType, string objectName)
|
||||
{}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Remoting;
|
||||
|
||||
@@ -82,13 +83,13 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// <summary>
|
||||
/// Convenience constant for subclasses: Return value for "do not proxy".
|
||||
/// </summary>
|
||||
protected static readonly object[] DO_NOT_PROXY = null;
|
||||
protected static readonly IList<object> DO_NOT_PROXY = null;
|
||||
|
||||
/// <summary>
|
||||
/// Convenience constant for subclasses: Return value for
|
||||
/// "proxy without additional interceptors, just the common ones".
|
||||
/// </summary>
|
||||
protected static readonly object[] PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS = new object[0];
|
||||
protected static readonly IList<object> PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS = new List<object>(0);
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -286,8 +287,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
}
|
||||
|
||||
//ITargetSource targetSource = GetCustomTargetSource(obj.GetType(), objectName);
|
||||
object[] specificInterceptors;
|
||||
specificInterceptors = GetAdvicesAndAdvisorsForObject(objectType, objectName, null);
|
||||
IList<object> specificInterceptors = GetAdvicesAndAdvisorsForObject(objectType, objectName, null);
|
||||
|
||||
|
||||
// proxy if we have advice or if a TargetSourceCreator wants to do some
|
||||
@@ -458,11 +458,11 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// <param name="targetType">the new object instance</param>
|
||||
/// <param name="targetName">the name of the object</param>
|
||||
/// <param name="customTargetSource">targetSource returned by TargetSource property:
|
||||
/// may be ignored. Will be null unless a custom target source is in use.</param>
|
||||
/// may be ignored. Will be null unless a custom target source is in use.</param>
|
||||
/// <returns>an array of additional interceptors for the particular object;
|
||||
/// or an empty array if no additional interceptors but just the common ones;
|
||||
/// or null if no proxy at all, not even with the common interceptors.</returns>
|
||||
protected abstract object[] GetAdvicesAndAdvisorsForObject(Type targetType, string targetName, ITargetSource customTargetSource);
|
||||
protected abstract IList<object> GetAdvicesAndAdvisorsForObject(Type targetType, string targetName, ITargetSource customTargetSource);
|
||||
|
||||
/// <summary>
|
||||
/// Create an AOP proxy for the given object.
|
||||
@@ -470,10 +470,10 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// <param name="targetType">Type of the object.</param>
|
||||
/// <param name="targetName">The name of the object.</param>
|
||||
/// <param name="specificInterceptors">The set of interceptors that is specific to this
|
||||
/// object (may be empty but not null)</param>
|
||||
/// object (may be empty but not null)</param>
|
||||
/// <param name="targetSource">The target source for the proxy, already pre-configured to access the object.</param>
|
||||
/// <returns>The AOP Proxy for the object.</returns>
|
||||
protected virtual object CreateProxy(Type targetType, string targetName, object[] specificInterceptors, ITargetSource targetSource)
|
||||
protected virtual object CreateProxy(Type targetType, string targetName, IList<object> specificInterceptors, ITargetSource targetSource)
|
||||
{
|
||||
ProxyFactory proxyFactory = CreateProxyFactory();
|
||||
// copy our properties (proxyTargetClass) inherited from ProxyConfig
|
||||
@@ -494,7 +494,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
}
|
||||
|
||||
|
||||
IAdvisor[] advisors = BuildAdvisors(targetName, specificInterceptors);
|
||||
IList<IAdvisor> advisors = BuildAdvisors(targetName, specificInterceptors);
|
||||
|
||||
foreach (IAdvisor advisor in advisors)
|
||||
{
|
||||
@@ -529,14 +529,14 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// </summary>
|
||||
/// <param name="targetName">The name of the object.</param>
|
||||
/// <param name="specificInterceptors">The set of interceptors that is specific to this
|
||||
/// object (may be empty, but not null)</param>
|
||||
/// object (may be empty, but not null)</param>
|
||||
/// <returns>The list of Advisors for the given object</returns>
|
||||
protected virtual IAdvisor[] BuildAdvisors(string targetName, object[] specificInterceptors)
|
||||
protected virtual IList<IAdvisor> BuildAdvisors(string targetName, IList<object> specificInterceptors)
|
||||
{
|
||||
// handle prototypes correctly
|
||||
IAdvisor[] commonInterceptors = ResolveInterceptorNames();
|
||||
IList<IAdvisor> commonInterceptors = ResolveInterceptorNames();
|
||||
|
||||
ArrayList allInterceptors = new ArrayList();
|
||||
List<object> allInterceptors = new List<object>();
|
||||
if (specificInterceptors != null)
|
||||
{
|
||||
allInterceptors.AddRange(specificInterceptors);
|
||||
@@ -544,26 +544,26 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
{
|
||||
if (applyCommonInterceptorsFirst)
|
||||
{
|
||||
allInterceptors.InsertRange(0, commonInterceptors);
|
||||
allInterceptors.InsertRange(0, commonInterceptors.Cast<object>());
|
||||
}
|
||||
else
|
||||
{
|
||||
allInterceptors.AddRange(commonInterceptors);
|
||||
allInterceptors.AddRange(commonInterceptors.Cast<object>());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (logger.IsInfoEnabled)
|
||||
{
|
||||
int nrOfCommonInterceptors = commonInterceptors != null ? commonInterceptors.Length : 0;
|
||||
int nrOfSpecificInterceptors = specificInterceptors != null ? specificInterceptors.Length : 0;
|
||||
int nrOfCommonInterceptors = commonInterceptors != null ? commonInterceptors.Count : 0;
|
||||
int nrOfSpecificInterceptors = specificInterceptors != null ? specificInterceptors.Count : 0;
|
||||
logger.Info(string.Format("Creating implicit proxy for object '{0}' with {1} common interceptors and {2} specific interceptors", targetName, nrOfCommonInterceptors, nrOfSpecificInterceptors));
|
||||
}
|
||||
|
||||
|
||||
IAdvisor[] advisors = new IAdvisor[allInterceptors.Count];
|
||||
List<IAdvisor> advisors = new List<IAdvisor>(allInterceptors.Count);
|
||||
for (int i = 0; i < allInterceptors.Count; i++)
|
||||
{
|
||||
advisors[i] = advisorAdapterRegistry.Wrap(allInterceptors[i]);
|
||||
advisors.Add(advisorAdapterRegistry.Wrap(allInterceptors[i]));
|
||||
}
|
||||
return advisors;
|
||||
}
|
||||
@@ -584,7 +584,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private IAdvisor[] ResolveInterceptorNames()
|
||||
private IList<IAdvisor> ResolveInterceptorNames()
|
||||
{
|
||||
List<IAdvisor> advisors = new List<IAdvisor>();
|
||||
foreach (string name in interceptorNames)
|
||||
@@ -599,7 +599,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
advisors.Add(advisorAdapterRegistry.Wrap(next));
|
||||
}
|
||||
}
|
||||
return advisors.ToArray();
|
||||
return advisors;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -659,7 +659,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
if (targetSource != null)
|
||||
{
|
||||
targetSourcedObjects.Add(objectName);
|
||||
object[] specificInterceptors = GetAdvicesAndAdvisorsForObject(objectType, objectName, targetSource);
|
||||
IList<object> specificInterceptors = GetAdvicesAndAdvisorsForObject(objectType, objectName, targetSource);
|
||||
return CreateProxy(objectType, objectName, specificInterceptors, targetSource);
|
||||
}
|
||||
return null;
|
||||
@@ -687,8 +687,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// been set.</param>
|
||||
/// <param name="objectName">Name of the object.</param>
|
||||
/// <returns>The passed in PropertyValues</returns>
|
||||
public IPropertyValues PostProcessPropertyValues(IPropertyValues pvs, PropertyInfo[] pis, object objectInstance,
|
||||
string objectName)
|
||||
public IPropertyValues PostProcessPropertyValues(IPropertyValues pvs, IList<PropertyInfo> pis, object objectInstance, string objectName)
|
||||
{
|
||||
return pvs;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -58,7 +59,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// Always <see cref="AbstractAutoProxyCreator.PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS"/> to indicate, that the object shall be proxied.
|
||||
/// </returns>
|
||||
/// <seealso cref="AbstractAutoProxyCreator.PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS"/>
|
||||
protected override object[] GetAdvicesAndAdvisorsForObject( Type targetType, string targetName, ITargetSource customTargetSource )
|
||||
protected override IList<object> GetAdvicesAndAdvisorsForObject(Type targetType, string targetName, ITargetSource customTargetSource)
|
||||
{
|
||||
return PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Spring.Objects.Factory;
|
||||
|
||||
#endregion
|
||||
@@ -45,7 +45,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
public static readonly string SEPARATOR = ".";
|
||||
private bool usePrefix;
|
||||
private string advisorObjectNamePrefix;
|
||||
private IList cachedAdvisors;
|
||||
private IList<IAdvisor> cachedAdvisors;
|
||||
|
||||
#region Properties
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// <param name="targetType">the type of the object to be advised</param>
|
||||
/// <param name="targetName">the name of the object to be advised</param>
|
||||
/// <returns>the list of candidate advisors</returns>
|
||||
protected override IList FindCandidateAdvisors(Type targetType, string targetName)
|
||||
protected override IList<IAdvisor> FindCandidateAdvisors(Type targetType, string targetName)
|
||||
{
|
||||
if (cachedAdvisors == null) {
|
||||
cachedAdvisors = base.FindCandidateAdvisors(targetType, targetName);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Spring.Aop.Framework.AutoProxy
|
||||
{
|
||||
@@ -13,6 +14,6 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// <summary>
|
||||
/// Get the list of advisor objects to apply on the target.
|
||||
/// </summary>
|
||||
IList FindAdvisorObjects(Type targetType, string targetName);
|
||||
IList<IAdvisor> FindAdvisorObjects(Type targetType, string targetName);
|
||||
}
|
||||
}
|
||||
@@ -176,8 +176,8 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// </remarks>
|
||||
public void PostProcessObjectFactory(IConfigurableListableObjectFactory factory)
|
||||
{
|
||||
string[] objectDefinitionNames = factory.GetObjectDefinitionNames();
|
||||
for (int i = 0; i < objectDefinitionNames.Length; ++i)
|
||||
IList<string> objectDefinitionNames = factory.GetObjectDefinitionNames();
|
||||
for (int i = 0; i < objectDefinitionNames.Count; ++i)
|
||||
{
|
||||
string name = objectDefinitionNames[i];
|
||||
if (IsObjectNameMatch(name))
|
||||
@@ -260,7 +260,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
proxyFactory.Interfaces = Type.EmptyTypes;
|
||||
}
|
||||
|
||||
IAdvisor[] advisors = ResolveInterceptorNames();
|
||||
IList<IAdvisor> advisors = ResolveInterceptorNames();
|
||||
foreach (IAdvisor advisor in advisors)
|
||||
{
|
||||
if (advisor is IIntroductionAdvisor)
|
||||
@@ -307,7 +307,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private IAdvisor[] ResolveInterceptorNames()
|
||||
private IList<IAdvisor> ResolveInterceptorNames()
|
||||
{
|
||||
List<IAdvisor> advisors = new List<IAdvisor>();
|
||||
foreach (string name in interceptorNames)
|
||||
@@ -322,7 +322,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
advisors.Add(advisorAdapterRegistry.Wrap(next));
|
||||
}
|
||||
}
|
||||
return advisors.ToArray();
|
||||
return advisors;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Common.Logging;
|
||||
@@ -38,7 +37,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
{
|
||||
private readonly ILog _log;
|
||||
private readonly IConfigurableListableObjectFactory _objectFactory;
|
||||
private string[] _cachedObjectNames;
|
||||
private List<string> _cachedObjectNames;
|
||||
|
||||
/// <summary>
|
||||
/// The object factory to lookup advisors from
|
||||
@@ -64,18 +63,18 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// <param name="targetType">the type of the object to be advised</param>
|
||||
/// <param name="targetName">the name of the object to be advised</param>
|
||||
/// <returns>A list of eligible <see cref="IAdvisor"/> instances</returns>
|
||||
public virtual IList FindAdvisorObjects(Type targetType, string targetName)
|
||||
public virtual IList<IAdvisor> FindAdvisorObjects(Type targetType, string targetName)
|
||||
{
|
||||
string[] advisorNames = GetAdvisorCandidateNames(targetType, targetName);
|
||||
IList<string> advisorNames = GetAdvisorCandidateNames(targetType, targetName);
|
||||
|
||||
List<IAdvisor> advisors = new List<IAdvisor>();
|
||||
|
||||
if (advisorNames.Length == 0)
|
||||
if (advisorNames.Count == 0)
|
||||
{
|
||||
return advisors;
|
||||
}
|
||||
|
||||
for (int i = 0; i < advisorNames.Length; i++)
|
||||
for (int i = 0; i < advisorNames.Count; i++)
|
||||
{
|
||||
string name = advisorNames[i];
|
||||
if (IsEligibleObject(name, targetType, targetName) && !_objectFactory.IsCurrentlyInCreation(name))
|
||||
@@ -137,7 +136,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// <param name="targetType">the type of the object to be advised</param>
|
||||
/// <param name="targetName">the name of the object to be advised</param>
|
||||
/// <returns>a non-null string array of advisor candidate names</returns>
|
||||
protected virtual string[] GetAdvisorCandidateNames(Type targetType, string targetName)
|
||||
protected virtual IList<string> GetAdvisorCandidateNames(Type targetType, string targetName)
|
||||
{
|
||||
if (_cachedObjectNames == null)
|
||||
{
|
||||
@@ -146,11 +145,11 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
if (_cachedObjectNames == null)
|
||||
{
|
||||
List<string> candidateNameList = new List<string>();
|
||||
string[] advisorCandidateNames = ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors( _objectFactory, typeof(IAdvisor), true, false);
|
||||
IList<string> advisorCandidateNames = ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors( _objectFactory, typeof(IAdvisor), true, false);
|
||||
candidateNameList.AddRange(advisorCandidateNames);
|
||||
string[] advisorsCandidateNames = ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(_objectFactory, typeof(IAdvisors), true, false);
|
||||
IList<string> advisorsCandidateNames = ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(_objectFactory, typeof(IAdvisors), true, false);
|
||||
candidateNameList.AddRange(advisorsCandidateNames);
|
||||
_cachedObjectNames = candidateNameList.ToArray();
|
||||
_cachedObjectNames = candidateNameList;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,7 +163,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
/// </summary>
|
||||
/// <param name="advisorName">the name of the candidate advisor</param>
|
||||
/// <param name="objectType">the type of the object to be advised</param>
|
||||
/// <param name="objectName">the name of the object to be advised</param>
|
||||
/// <param name="objectName">the name of the object to be advised</param>
|
||||
protected virtual bool IsEligibleObject(string advisorName, Type objectType, string objectName )
|
||||
{
|
||||
bool containsObjectDefinition = this.ObjectFactory.ContainsObjectDefinition(advisorName);
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
{
|
||||
throw new AopConfigException("Cannot create IAopProxy with null ProxyConfig");
|
||||
}
|
||||
if (advisedSupport.Advisors.Length == 0 && advisedSupport.TargetSource == EmptyTargetSource.Empty)
|
||||
if (advisedSupport.Advisors.Count == 0 && advisedSupport.TargetSource == EmptyTargetSource.Empty)
|
||||
{
|
||||
throw new AopConfigException("Cannot create IAopProxy with no advisors and no target source");
|
||||
}
|
||||
|
||||
@@ -165,8 +165,8 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
this.m_targetType = advised.TargetSource.TargetType;
|
||||
|
||||
// initialize introduction advice
|
||||
this.m_introductions = new IAdvice[advised.Introductions.Length];
|
||||
for (int i = 0; i < advised.Introductions.Length; i++)
|
||||
this.m_introductions = new IAdvice[advised.Introductions.Count];
|
||||
for (int i = 0; i < advised.Introductions.Count; i++)
|
||||
{
|
||||
this.m_introductions[i] = advised.Introductions[i].Advice;
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
/// <returns>list of inteceptors for the specified method</returns>
|
||||
public IList<object> GetInterceptors(Type targetType, MethodInfo method)
|
||||
{
|
||||
if (m_advised.Advisors.Length == 0)
|
||||
if (m_advised.Advisors.Count == 0)
|
||||
{
|
||||
return EmptyList;
|
||||
}
|
||||
@@ -252,17 +252,17 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
get { return m_advised.ProxyTargetAttributes; }
|
||||
}
|
||||
|
||||
IAdvisor[] IAdvised.Advisors
|
||||
IList<IAdvisor> IAdvised.Advisors
|
||||
{
|
||||
get { return m_advised.Advisors; }
|
||||
}
|
||||
|
||||
IIntroductionAdvisor[] IAdvised.Introductions
|
||||
IList<IIntroductionAdvisor> IAdvised.Introductions
|
||||
{
|
||||
get { return m_advised.Introductions; }
|
||||
}
|
||||
|
||||
Type[] IAdvised.Interfaces
|
||||
IList<Type> IAdvised.Interfaces
|
||||
{
|
||||
get { return m_advised.Interfaces; }
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
|
||||
@@ -123,27 +124,27 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
/// </summary>
|
||||
private sealed class ProxyTypeCacheKey
|
||||
{
|
||||
private sealed class HashCodeComparer : IComparer
|
||||
private sealed class HashCodeComparer : IComparer<Type>
|
||||
{
|
||||
public int Compare(object x, object y)
|
||||
public int Compare(Type x, Type y)
|
||||
{
|
||||
return x.GetHashCode().CompareTo(y.GetHashCode());
|
||||
}
|
||||
}
|
||||
|
||||
private static IComparer interfaceComparer = new HashCodeComparer();
|
||||
private static HashCodeComparer interfaceComparer = new HashCodeComparer();
|
||||
|
||||
private Type baseType;
|
||||
private Type targetType;
|
||||
private Type[] interfaceTypes;
|
||||
private List<Type> interfaceTypes;
|
||||
private bool proxyTargetAttributes;
|
||||
|
||||
public ProxyTypeCacheKey(Type baseType, Type targetType, Type[] interfaceTypes, bool proxyTargetAttributes)
|
||||
public ProxyTypeCacheKey(Type baseType, Type targetType, IList<Type> interfaceTypes, bool proxyTargetAttributes)
|
||||
{
|
||||
this.baseType = baseType;
|
||||
this.targetType = targetType;
|
||||
Array.Sort(interfaceTypes, interfaceComparer); // sort by GetHashcode()? to have a defined order
|
||||
this.interfaceTypes = interfaceTypes;
|
||||
this.interfaceTypes = new List<Type>(interfaceTypes);
|
||||
this.interfaceTypes.Sort(interfaceComparer); // sort by GetHashcode()? to have a defined order
|
||||
this.proxyTargetAttributes = proxyTargetAttributes;
|
||||
}
|
||||
|
||||
@@ -166,7 +167,7 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < interfaceTypes.Length; i++)
|
||||
for (int i = 0; i < interfaceTypes.Count; i++)
|
||||
{
|
||||
if (!Equals(interfaceTypes[i], proxyTypeCacheKey.interfaceTypes[i]))
|
||||
{
|
||||
@@ -184,7 +185,7 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
{
|
||||
int result = baseType.GetHashCode();
|
||||
result = 29*result + targetType.GetHashCode();
|
||||
for (int i = 0; i < interfaceTypes.Length; i++)
|
||||
for (int i = 0; i < interfaceTypes.Count; i++)
|
||||
{
|
||||
result = 29 * result + interfaceTypes[i].GetHashCode();
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
{
|
||||
IProxyTypeBuilder typeBuilder;
|
||||
if ((advisedSupport.ProxyTargetType) ||
|
||||
(advisedSupport.Interfaces.Length == 0))
|
||||
(advisedSupport.Interfaces.Count == 0))
|
||||
{
|
||||
typeBuilder = new DecoratorAopProxyTypeBuilder(advisedSupport);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using AopAlliance.Aop;
|
||||
|
||||
@@ -109,7 +110,7 @@ namespace Spring.Aop.Framework
|
||||
/// The collection of <see cref="Spring.Aop.IAdvisor"/>
|
||||
/// instances that have been applied to this proxy.
|
||||
/// </value>
|
||||
IAdvisor[] Advisors { get; }
|
||||
IList<IAdvisor> Advisors { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the collection of <see cref="Spring.Aop.IIntroductionAdvisor"/>
|
||||
@@ -127,7 +128,7 @@ namespace Spring.Aop.Framework
|
||||
/// The collection of <see cref="Spring.Aop.IIntroductionAdvisor"/>
|
||||
/// instances that have been applied to this proxy.
|
||||
/// </value>
|
||||
IIntroductionAdvisor[] Introductions { get; }
|
||||
IList<IIntroductionAdvisor> Introductions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the collection of interface <see cref="System.Type"/>s
|
||||
@@ -137,7 +138,7 @@ namespace Spring.Aop.Framework
|
||||
/// The collection of interface <see cref="System.Type"/>s
|
||||
/// to be (or that are being) proxied by this proxy.
|
||||
/// </value>
|
||||
Type[] Interfaces { get; }
|
||||
IList<Type> Interfaces { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the mapping of the proxied interface
|
||||
|
||||
@@ -397,7 +397,7 @@ namespace Spring.Aop.Framework
|
||||
{
|
||||
return this.singletonInstance.GetType();
|
||||
}
|
||||
else if (Interfaces.Length == 1)
|
||||
else if (Interfaces.Count == 1)
|
||||
{
|
||||
return Interfaces[0];
|
||||
}
|
||||
@@ -457,7 +457,7 @@ namespace Spring.Aop.Framework
|
||||
// The copy needs a fresh advisor chain, and a fresh TargetSource.
|
||||
ITargetSource targetSource = FreshTargetSource();
|
||||
IList<IAdvisor> advisorChain = FreshAdvisorChain();
|
||||
IList<IAdvisor> introductionChain = FreshIntroductionChain();
|
||||
IList<IIntroductionAdvisor> introductionChain = FreshIntroductionChain();
|
||||
AdvisedSupport copy = new AdvisedSupport();
|
||||
copy.CopyConfigurationFrom(this, targetSource, advisorChain, introductionChain);
|
||||
|
||||
@@ -625,16 +625,16 @@ namespace Spring.Aop.Framework
|
||||
/// <summary> Add all global interceptors and pointcuts.</summary>
|
||||
private void AddGlobalAdvisor(IListableObjectFactory objectFactory, string prefix)
|
||||
{
|
||||
string[] globalAspectNames =
|
||||
IList<string> globalAspectNames =
|
||||
ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(objectFactory, typeof(IAdvisors));
|
||||
string[] globalAdvisorNames =
|
||||
IList<string> globalAdvisorNames =
|
||||
ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(objectFactory, typeof(IAdvisor));
|
||||
string[] globalInterceptorNames =
|
||||
IList<string> globalInterceptorNames =
|
||||
ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(objectFactory, typeof(IInterceptor));
|
||||
List<object> objects = new List<object>();
|
||||
Dictionary<object, string> names = new Dictionary<object, string>();
|
||||
|
||||
for (int i = 0; i < globalAspectNames.Length; i++)
|
||||
for (int i = 0; i < globalAspectNames.Count; i++)
|
||||
{
|
||||
string name = globalAspectNames[i];
|
||||
if (name.StartsWith(prefix))
|
||||
@@ -651,7 +651,7 @@ namespace Spring.Aop.Framework
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < globalAdvisorNames.Length; i++)
|
||||
for (int i = 0; i < globalAdvisorNames.Count; i++)
|
||||
{
|
||||
string name = globalAdvisorNames[i];
|
||||
if (name.StartsWith(prefix))
|
||||
@@ -665,7 +665,7 @@ namespace Spring.Aop.Framework
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < globalInterceptorNames.Length; i++)
|
||||
for (int i = 0; i < globalInterceptorNames.Count; i++)
|
||||
{
|
||||
string name = globalInterceptorNames[i];
|
||||
if (name.StartsWith(prefix))
|
||||
@@ -737,16 +737,16 @@ namespace Spring.Aop.Framework
|
||||
/// <summary> Add all global introductions.</summary>
|
||||
private void AddGlobalIntroduction(IListableObjectFactory objectFactory, string prefix)
|
||||
{
|
||||
string[] globalAspectNames =
|
||||
IList<string> globalAspectNames =
|
||||
ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(objectFactory, typeof(IAdvisors));
|
||||
string[] globalAdvisorNames =
|
||||
IList<string> globalAdvisorNames =
|
||||
ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(objectFactory, typeof(IAdvisor));
|
||||
string[] globalIntroductionNames =
|
||||
IList<string> globalIntroductionNames =
|
||||
ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(objectFactory, typeof(IAdvice));
|
||||
ArrayList objects = new ArrayList();
|
||||
Dictionary<object, string> names = new Dictionary<object, string>();
|
||||
|
||||
for (int i = 0; i < globalAspectNames.Length; i++)
|
||||
for (int i = 0; i < globalAspectNames.Count; i++)
|
||||
{
|
||||
string name = globalAspectNames[i];
|
||||
if (name.StartsWith(prefix))
|
||||
@@ -763,7 +763,7 @@ namespace Spring.Aop.Framework
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < globalAdvisorNames.Length; i++)
|
||||
for (int i = 0; i < globalAdvisorNames.Count; i++)
|
||||
{
|
||||
string name = globalAdvisorNames[i];
|
||||
if (name.StartsWith(prefix))
|
||||
@@ -777,7 +777,7 @@ namespace Spring.Aop.Framework
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < globalIntroductionNames.Length; i++)
|
||||
for (int i = 0; i < globalIntroductionNames.Count; i++)
|
||||
{
|
||||
string name = globalIntroductionNames[i];
|
||||
if (name.StartsWith(prefix))
|
||||
@@ -850,7 +850,7 @@ namespace Spring.Aop.Framework
|
||||
/// </summary>
|
||||
private IList<IAdvisor> FreshAdvisorChain()
|
||||
{
|
||||
IAdvisor[] advisors = Advisors;
|
||||
IList<IAdvisor> advisors = Advisors;
|
||||
List<IAdvisor> freshAdvisors = new List<IAdvisor>();
|
||||
foreach (IAdvisor advisor in advisors)
|
||||
{
|
||||
@@ -881,10 +881,10 @@ namespace Spring.Aop.Framework
|
||||
/// We need to do this every time a new prototype instance is returned,
|
||||
/// to return distinct instances of prototype interfaces and pointcuts.
|
||||
/// </summary>
|
||||
private IList<IAdvisor> FreshIntroductionChain()
|
||||
private IList<IIntroductionAdvisor> FreshIntroductionChain()
|
||||
{
|
||||
IIntroductionAdvisor[] introductions = Introductions;
|
||||
List<IAdvisor> freshIntroductions = new List<IAdvisor>();
|
||||
IList<IIntroductionAdvisor> introductions = Introductions;
|
||||
List<IIntroductionAdvisor> freshIntroductions = new List<IIntroductionAdvisor>();
|
||||
foreach (IIntroductionAdvisor introduction in introductions)
|
||||
{
|
||||
if (introduction is PrototypePlaceholder)
|
||||
@@ -899,7 +899,7 @@ namespace Spring.Aop.Framework
|
||||
AssertUtils.ArgumentNotNull(this.objectFactory, "ObjectFactory");
|
||||
|
||||
object introductionObject = this.objectFactory.GetObject(pa.ObjectName);
|
||||
IAdvisor freshIntroduction = NamedObjectToIntroduction(introductionObject);
|
||||
IIntroductionAdvisor freshIntroduction = NamedObjectToIntroduction(introductionObject);
|
||||
freshIntroductions.Add(freshIntroduction);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -93,6 +93,9 @@
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data">
|
||||
<Name>System.Data</Name>
|
||||
</Reference>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
||||
#endregion
|
||||
@@ -46,16 +47,16 @@ namespace Spring.Context
|
||||
/// Return the codes to be used to resolve this message, in the order
|
||||
/// that they are to be tried.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// The last code will therefore be the default one.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// The last code will therefore be the default one.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
/// <returns>
|
||||
/// A <see cref="System.String"/> array of codes which are associated
|
||||
/// with this message.
|
||||
/// </returns>
|
||||
string[] GetCodes();
|
||||
IList<string> GetCodes();
|
||||
|
||||
/// <summary>
|
||||
/// Return the array of arguments to be used to resolve this message.
|
||||
|
||||
@@ -513,7 +513,7 @@ namespace Spring.Context.Support
|
||||
}
|
||||
}
|
||||
|
||||
IDictionary<string, IObjectDefinitionRegistryPostProcessor> objectMap = objectFactory.GetObjectsOfType<IObjectDefinitionRegistryPostProcessor>(true, false);
|
||||
IDictionary<string, IObjectDefinitionRegistryPostProcessor> objectMap = objectFactory.GetObjects<IObjectDefinitionRegistryPostProcessor>(true, false);
|
||||
|
||||
List<IObjectDefinitionRegistryPostProcessor> registryPostProcessorObjects = new List<IObjectDefinitionRegistryPostProcessor>(objectMap.Values);
|
||||
registryPostProcessorObjects.Sort(new OrderComparator<IObjectDefinitionRegistryPostProcessor>());
|
||||
@@ -547,11 +547,8 @@ namespace Spring.Context.Support
|
||||
// Do not initialize FactoryBeans here: We need to leave all regular beans
|
||||
// uninitialized to let the bean factory post-processors apply to them!
|
||||
List<string> factoryProcessorNames = new List<string>();
|
||||
string[] names = GetObjectNamesForType(typeof(IObjectFactoryPostProcessor), true, false);
|
||||
foreach (string name in names)
|
||||
{
|
||||
factoryProcessorNames.Add(name);
|
||||
}
|
||||
IList<string> names = GetObjectNamesForType(typeof(IObjectFactoryPostProcessor), true, false);
|
||||
factoryProcessorNames.AddRange(names);
|
||||
|
||||
// Separate between ObjectFactoryPostProcessors that implement PriorityOrdered,
|
||||
// Ordered, and the rest.
|
||||
@@ -621,7 +618,7 @@ namespace Spring.Context.Support
|
||||
|
||||
// Now will find any additional IObjectFactoryPostProcessors that implement IPriorityOrdered that may have been
|
||||
// resolved due to using TypeAlias
|
||||
string[] factoryProcessorNamesAfterTypeAlias = GetObjectNamesForType(typeof(IObjectFactoryPostProcessor), true, false);
|
||||
IList<string> factoryProcessorNamesAfterTypeAlias = GetObjectNamesForType(typeof(IObjectFactoryPostProcessor), true, false);
|
||||
priorityOrderedFactoryProcessors.Clear();
|
||||
foreach (string factoryProcessorName in factoryProcessorNamesAfterTypeAlias)
|
||||
{
|
||||
@@ -649,7 +646,7 @@ namespace Spring.Context.Support
|
||||
private void RegisterObjectPostProcessors(IConfigurableListableObjectFactory objectFactory)
|
||||
{
|
||||
RefreshObjectPostProcessorChecker(objectFactory);
|
||||
IDictionary<string, IObjectPostProcessor> dict = GetObjectsOfType<IObjectPostProcessor>(true, false);
|
||||
IDictionary<string, IObjectPostProcessor> dict = GetObjects<IObjectPostProcessor>(true, false);
|
||||
List<IObjectPostProcessor> objectProcessors = new List<IObjectPostProcessor>(dict.Values);
|
||||
// objectProcessors.Sort(new OrderComparator());
|
||||
foreach (IObjectPostProcessor objectPostProcessor in objectProcessors)
|
||||
@@ -675,7 +672,7 @@ namespace Spring.Context.Support
|
||||
/// </summary>
|
||||
private void RefreshObjectPostProcessorChecker(IConfigurableListableObjectFactory objectFactory)
|
||||
{
|
||||
int registeredObjectPostProcessorCount = GetObjectNamesForType(typeof(IObjectPostProcessor), true, false).Length;
|
||||
int registeredObjectPostProcessorCount = GetObjectNamesForType(typeof(IObjectPostProcessor), true, false).Count;
|
||||
int objectPostProcessorCount = ObjectFactory.ObjectPostProcessorCount + 1
|
||||
+ registeredObjectPostProcessorCount;
|
||||
((ObjectPostProcessorChecker)_defaultObjectPostProcessors[0]).Reset(objectFactory, objectPostProcessorCount);
|
||||
@@ -733,7 +730,7 @@ namespace Spring.Context.Support
|
||||
|
||||
#endregion
|
||||
}
|
||||
ICollection<IEventRegistryAware> interestedParties = GetObjectsOfType<IEventRegistryAware>(true, false).Values;
|
||||
ICollection<IEventRegistryAware> interestedParties = GetObjects<IEventRegistryAware>(true, false).Values;
|
||||
foreach (IEventRegistryAware party in interestedParties)
|
||||
{
|
||||
party.EventRegistry = EventRegistry;
|
||||
@@ -856,7 +853,7 @@ namespace Spring.Context.Support
|
||||
|
||||
private void RefreshApplicationEventListeners()
|
||||
{
|
||||
ICollection<IApplicationEventListener> listeners = GetObjectsOfType<IApplicationEventListener>(true, false).Values;
|
||||
ICollection<IApplicationEventListener> listeners = GetObjects<IApplicationEventListener>(true, false).Values;
|
||||
foreach (IApplicationEventListener applicationListener in listeners)
|
||||
{
|
||||
EventRegistry.Subscribe(applicationListener);
|
||||
@@ -1165,7 +1162,7 @@ namespace Spring.Context.Support
|
||||
get
|
||||
{
|
||||
IConfigurableListableObjectFactory objectFactory = ObjectFactory;
|
||||
string[] objectNames = objectFactory.SingletonNames;
|
||||
IList<string> objectNames = objectFactory.SingletonNames;
|
||||
IDictionary<string, ILifecycle> lifeCycleObjects = new Dictionary<string, ILifecycle>();
|
||||
foreach (string objectName in objectNames)
|
||||
{
|
||||
@@ -1232,7 +1229,7 @@ namespace Spring.Context.Support
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
/// <seealso cref="Spring.Objects.Factory.IListableObjectFactory.GetObjectNamesForType(Type)"/>
|
||||
public string[] GetObjectNamesForType(Type type)
|
||||
public IList<string> GetObjectNamesForType(Type type)
|
||||
{
|
||||
return ObjectFactory.GetObjectNamesForType(type);
|
||||
}
|
||||
@@ -1260,7 +1257,7 @@ namespace Spring.Context.Support
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
public string[] GetObjectNamesForType<T>()
|
||||
public IList<string> GetObjectNames<T>()
|
||||
{
|
||||
return GetObjectNamesForType(typeof(T));
|
||||
}
|
||||
@@ -1286,8 +1283,7 @@ namespace Spring.Context.Support
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
/// <seealso cref="Spring.Objects.Factory.IListableObjectFactory.GetObjectNamesForType(Type, bool, bool)"/>
|
||||
public string[] GetObjectNamesForType(
|
||||
Type type, bool includePrototypes, bool includeFactoryObjects)
|
||||
public IList<string> GetObjectNamesForType(Type type, bool includePrototypes, bool includeFactoryObjects)
|
||||
{
|
||||
return ObjectFactory.GetObjectNamesForType(type, includePrototypes, includeFactoryObjects);
|
||||
}
|
||||
@@ -1327,7 +1323,7 @@ namespace Spring.Context.Support
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
public string[] GetObjectNamesForType<T>(bool includePrototypes, bool includeFactoryObjects)
|
||||
public IList<string> GetObjectNames<T>(bool includePrototypes, bool includeFactoryObjects)
|
||||
{
|
||||
return GetObjectNamesForType(typeof(T), includePrototypes, includeFactoryObjects);
|
||||
}
|
||||
@@ -1340,7 +1336,7 @@ namespace Spring.Context.Support
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
/// <seealso cref="Spring.Objects.Factory.IListableObjectFactory.GetObjectDefinitionNames()"/>
|
||||
public string[] GetObjectDefinitionNames()
|
||||
public IList<string> GetObjectDefinitionNames()
|
||||
{
|
||||
return ObjectFactory.GetObjectDefinitionNames();
|
||||
}
|
||||
@@ -1442,9 +1438,9 @@ namespace Spring.Context.Support
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// If the objects could not be created.
|
||||
/// </exception>
|
||||
public IDictionary<string, T> GetObjectsOfType<T>()
|
||||
public IDictionary<string, T> GetObjects<T>()
|
||||
{
|
||||
return ObjectFactory.GetObjectsOfType<T>(true, true);
|
||||
return ObjectFactory.GetObjects<T>(true, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1506,9 +1502,9 @@ namespace Spring.Context.Support
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// If the objects could not be created.
|
||||
/// </exception>
|
||||
public IDictionary<string, T> GetObjectsOfType<T>(bool includePrototypes, bool includeFactoryObjects)
|
||||
public IDictionary<string, T> GetObjects<T>(bool includePrototypes, bool includeFactoryObjects)
|
||||
{
|
||||
return ObjectFactory.GetObjectsOfType<T>(includePrototypes, includeFactoryObjects);
|
||||
return ObjectFactory.GetObjects<T>(includePrototypes, includeFactoryObjects);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1542,13 +1538,13 @@ namespace Spring.Context.Support
|
||||
/// </exception>
|
||||
public T GetObject<T>()
|
||||
{
|
||||
string[] objectNamesForType = GetObjectNamesForType(typeof(T));
|
||||
if ((objectNamesForType == null) || (objectNamesForType.Length == 0))
|
||||
IList<string> objectNamesForType = GetObjectNamesForType(typeof(T));
|
||||
if ((objectNamesForType == null) || (objectNamesForType.Count == 0))
|
||||
{
|
||||
throw new NoSuchObjectDefinitionException(typeof(T).FullName, "Requested Type not Defined in the Context.");
|
||||
}
|
||||
|
||||
if (objectNamesForType.Length > 1)
|
||||
if (objectNamesForType.Count > 1)
|
||||
{
|
||||
throw new ObjectDefinitionStoreException(string.Format("More than one definition for {0} found in the Context.", typeof(T).FullName));
|
||||
}
|
||||
@@ -1624,7 +1620,7 @@ namespace Spring.Context.Support
|
||||
/// If there's no such object definition.
|
||||
/// </exception>
|
||||
/// <seealso cref="Spring.Objects.Factory.IObjectFactory.GetAliases(string)"/>
|
||||
public string[] GetAliases(string name)
|
||||
public IList<string> GetAliases(string name)
|
||||
{
|
||||
return ObjectFactory.GetAliases(name);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Common.Logging;
|
||||
|
||||
@@ -282,21 +283,21 @@ namespace Spring.Context.Support
|
||||
/// </exception>
|
||||
public string GetMessage(IMessageSourceResolvable resolvable, CultureInfo culture)
|
||||
{
|
||||
string[] codes = resolvable.GetCodes();
|
||||
IList<string> codes = resolvable.GetCodes();
|
||||
if (codes == null) codes = new string[0];
|
||||
for (int i = 0; i < codes.Length; i++)
|
||||
for (int i = 0; i < codes.Count; i++)
|
||||
{
|
||||
string msg = GetMessageInternal(codes[i], resolvable.GetArguments(), culture);
|
||||
if (msg != null) return msg;
|
||||
}
|
||||
if (resolvable.DefaultMessage != null)
|
||||
return RenderDefaultMessage(resolvable.DefaultMessage, resolvable.GetArguments(), culture);
|
||||
if (codes.Length > 0)
|
||||
if (codes.Count > 0)
|
||||
{
|
||||
string fallback = GetDefaultMessage(codes[0]);
|
||||
if (fallback != null) return fallback;
|
||||
}
|
||||
throw new NoSuchMessageException(codes.Length > 0 ? codes[codes.Length - 1] : null, culture);
|
||||
throw new NoSuchMessageException(codes.Count > 0 ? codes[codes.Count - 1] : null, culture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -282,7 +282,7 @@ namespace Spring.Context.Support
|
||||
bool caseSensitive = GetCaseSensitivity(contextElement);
|
||||
|
||||
// get resource-list
|
||||
string[] resources = GetResources(contextElement);
|
||||
IList<string> resources = GetResources(contextElement);
|
||||
|
||||
// finally create the context instance
|
||||
context = InstantiateContext(parentContext, configContext, contextName, contextType, caseSensitive, resources);
|
||||
@@ -293,7 +293,7 @@ namespace Spring.Context.Support
|
||||
}
|
||||
|
||||
// get and create child context definitions
|
||||
XmlNode[] childContexts = GetChildContexts(contextElement);
|
||||
IList<XmlNode> childContexts = GetChildContexts(contextElement);
|
||||
CreateChildContexts(context, configContext, childContexts);
|
||||
|
||||
if (Log.IsDebugEnabled) Log.Debug( string.Format("context '{0}' created for name '{1}'", context, contextName) );
|
||||
@@ -309,15 +309,15 @@ namespace Spring.Context.Support
|
||||
throw;
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create all child-contexts in the given <see cref="XmlNodeList"/> for the given context.
|
||||
/// </summary>
|
||||
/// <param name="parentContext">The parent context to use</param>
|
||||
/// <param name="configContext">The current configContext <see cref="IConfigurationSectionHandler.Create"/></param>
|
||||
/// <param name="childContexts">The list of child context elements</param>
|
||||
protected virtual void CreateChildContexts(IApplicationContext parentContext, object configContext, XmlNode[] childContexts)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create all child-contexts in the given <see cref="XmlNodeList"/> for the given context.
|
||||
/// </summary>
|
||||
/// <param name="parentContext">The parent context to use</param>
|
||||
/// <param name="configContext">The current configContext <see cref="IConfigurationSectionHandler.Create"/></param>
|
||||
/// <param name="childContexts">The list of child context elements</param>
|
||||
protected virtual void CreateChildContexts(IApplicationContext parentContext, object configContext, IList<XmlNode> childContexts)
|
||||
{
|
||||
// create child contexts for 'the most recently created context'...
|
||||
foreach (XmlNode childContext in childContexts)
|
||||
@@ -329,18 +329,18 @@ namespace Spring.Context.Support
|
||||
/// <summary>
|
||||
/// Instantiates a new context.
|
||||
/// </summary>
|
||||
protected virtual IApplicationContext InstantiateContext(IApplicationContext parentContext, object configContext, string contextName, Type contextType, bool caseSensitive, string[] resources)
|
||||
protected virtual IApplicationContext InstantiateContext(IApplicationContext parentContext, object configContext, string contextName, Type contextType, bool caseSensitive, IList<string> resources)
|
||||
{
|
||||
IApplicationContext context;
|
||||
ContextInstantiator instantiator;
|
||||
|
||||
if (parentContext == null)
|
||||
{
|
||||
instantiator = new RootContextInstantiator(contextType, contextName, caseSensitive, resources);
|
||||
instantiator = new RootContextInstantiator(contextType, contextName, caseSensitive, new List<string>(resources).ToArray());
|
||||
}
|
||||
else
|
||||
{
|
||||
instantiator = new DescendantContextInstantiator(parentContext, contextType, contextName, caseSensitive, resources);
|
||||
{
|
||||
instantiator = new DescendantContextInstantiator(parentContext, contextType, contextName, caseSensitive, new List<string>(resources).ToArray());
|
||||
}
|
||||
|
||||
if (IsLazy)
|
||||
@@ -446,7 +446,7 @@ namespace Spring.Context.Support
|
||||
/// Returns the array of resources containing object definitions for
|
||||
/// this context.
|
||||
/// </summary>
|
||||
private string[] GetResources( XmlElement contextElement )
|
||||
private IList<string> GetResources( XmlElement contextElement )
|
||||
{
|
||||
List<string> resourceNodes = new List<string>(contextElement.ChildNodes.Count);
|
||||
foreach (XmlNode possibleResourceNode in contextElement.ChildNodes)
|
||||
@@ -462,13 +462,13 @@ namespace Spring.Context.Support
|
||||
}
|
||||
}
|
||||
}
|
||||
return resourceNodes.ToArray();
|
||||
return resourceNodes;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the array of child contexts for this context.
|
||||
/// </summary>
|
||||
private XmlNode[] GetChildContexts(XmlElement contextElement)
|
||||
private IList<XmlNode> GetChildContexts(XmlElement contextElement)
|
||||
{
|
||||
List<XmlNode> contextNodes = new List<XmlNode>(contextElement.ChildNodes.Count);
|
||||
foreach (XmlNode possibleContextNode in contextElement.ChildNodes)
|
||||
@@ -480,7 +480,7 @@ namespace Spring.Context.Support
|
||||
contextNodes.Add(possibleContextElement);
|
||||
}
|
||||
}
|
||||
return contextNodes.ToArray();
|
||||
return contextNodes;
|
||||
}
|
||||
|
||||
#region Inner Class : ContextInstantiator
|
||||
@@ -528,7 +528,7 @@ namespace Spring.Context.Support
|
||||
get { return _caseSensitive; }
|
||||
}
|
||||
|
||||
protected string[] Resources
|
||||
protected IList<string> Resources
|
||||
{
|
||||
get { return _resources; }
|
||||
}
|
||||
@@ -536,7 +536,7 @@ namespace Spring.Context.Support
|
||||
private Type _contextType;
|
||||
private string _contextName;
|
||||
private bool _caseSensitive;
|
||||
private string[] _resources;
|
||||
private IList<string> _resources;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Spring.Util;
|
||||
|
||||
@@ -44,7 +45,7 @@ namespace Spring.Context.Support
|
||||
[Serializable]
|
||||
public class DefaultMessageSourceResolvable : IMessageSourceResolvable
|
||||
{
|
||||
private string[] codes;
|
||||
private IList<string> codes;
|
||||
private object[] arguments;
|
||||
private string defaultMessage;
|
||||
|
||||
@@ -97,7 +98,7 @@ namespace Spring.Context.Support
|
||||
/// The default message used if no code could be resolved.
|
||||
/// </param>
|
||||
public DefaultMessageSourceResolvable(
|
||||
string[] codes, object[] arguments, string defaultMessage)
|
||||
IList<string> codes, object[] arguments, string defaultMessage)
|
||||
{
|
||||
this.codes = codes;
|
||||
this.arguments = arguments;
|
||||
@@ -141,9 +142,9 @@ namespace Spring.Context.Support
|
||||
{
|
||||
get
|
||||
{
|
||||
if (codes != null && codes.Length > 0)
|
||||
if (codes != null && codes.Count > 0)
|
||||
{
|
||||
return codes[codes.Length - 1];
|
||||
return codes[codes.Count - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -181,16 +182,16 @@ namespace Spring.Context.Support
|
||||
|
||||
#region IMessageSourceResolvable Members
|
||||
|
||||
/// <summary>
|
||||
/// Return the codes to be used to resolve this message, in the order
|
||||
/// that they are to be tried.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A <see cref="System.String"/> array of codes which are associated
|
||||
/// with this message.
|
||||
/// </returns>
|
||||
/// <seealso cref="Spring.Context.IMessageSourceResolvable.GetCodes"/>
|
||||
public string[] GetCodes()
|
||||
/// <summary>
|
||||
/// Return the codes to be used to resolve this message, in the order
|
||||
/// that they are to be tried.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A <see cref="System.String"/> array of codes which are associated
|
||||
/// with this message.
|
||||
/// </returns>
|
||||
/// <seealso cref="Spring.Context.IMessageSourceResolvable.GetCodes"/>
|
||||
public IList<string> GetCodes()
|
||||
{
|
||||
return codes;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#region Imports
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
||||
using Spring.Util;
|
||||
@@ -352,8 +353,8 @@ namespace Spring.Context.Support
|
||||
{
|
||||
return resolvable.DefaultMessage;
|
||||
}
|
||||
string[] codes = resolvable.GetCodes();
|
||||
string code = (codes != null && codes.Length > 0 ? codes[0] : string.Empty);
|
||||
IList<string> codes = resolvable.GetCodes();
|
||||
string code = (codes != null && codes.Count > 0 ? codes[0] : string.Empty);
|
||||
throw new NoSuchMessageException(code, culture);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -123,7 +122,7 @@ namespace Spring.Core.TypeResolution
|
||||
/// If <paramref name="interfaceNames"/> (or any of its elements ) is
|
||||
/// <see langword="null"/>.
|
||||
/// </exception>
|
||||
public static Type[] ResolveInterfaceArray(string[] interfaceNames)
|
||||
public static IList<Type> ResolveInterfaceArray(string[] interfaceNames)
|
||||
{
|
||||
AssertUtils.ArgumentNotNull(interfaceNames, "interfaceNames");
|
||||
|
||||
@@ -144,7 +143,7 @@ namespace Spring.Core.TypeResolution
|
||||
interfaces.Add(resolvedInterface);
|
||||
interfaces.AddRange(resolvedInterface.GetInterfaces());
|
||||
}
|
||||
return interfaces.ToArray();
|
||||
return interfaces;
|
||||
}
|
||||
|
||||
#region MethodMatch
|
||||
|
||||
@@ -179,15 +179,15 @@ namespace Spring.Expressions
|
||||
|
||||
private static ConstructorInfo GetBestConstructor(Type type, object[] argValues)
|
||||
{
|
||||
ConstructorInfo[] candidates = GetCandidateConstructors(type, argValues.Length);
|
||||
if (candidates.Length > 0)
|
||||
IList<ConstructorInfo> candidates = GetCandidateConstructors(type, argValues.Length);
|
||||
if (candidates.Count > 0)
|
||||
{
|
||||
return ReflectionUtils.GetConstructorByArgumentValues(candidates, argValues);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static ConstructorInfo[] GetCandidateConstructors(Type type, int argCount)
|
||||
private static IList<ConstructorInfo> GetCandidateConstructors(Type type, int argCount)
|
||||
{
|
||||
ConstructorInfo[] ctors = type.GetConstructors(BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic);
|
||||
List<ConstructorInfo> matches = new List<ConstructorInfo>();
|
||||
@@ -209,7 +209,7 @@ namespace Spring.Expressions
|
||||
}
|
||||
}
|
||||
|
||||
return matches.ToArray();
|
||||
return matches;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -234,8 +234,8 @@ namespace Spring.Expressions
|
||||
catch (AmbiguousMatchException)
|
||||
{
|
||||
|
||||
MethodInfo[] overloads = GetCandidateMethods(type, methodName, bindingFlags, argValues.Length);
|
||||
if (overloads.Length > 0)
|
||||
IList<MethodInfo> overloads = GetCandidateMethods(type, methodName, bindingFlags, argValues.Length);
|
||||
if (overloads.Count > 0)
|
||||
{
|
||||
mi = ReflectionUtils.GetMethodByArgumentValues(overloads, argValues);
|
||||
}
|
||||
@@ -245,7 +245,7 @@ namespace Spring.Expressions
|
||||
|
||||
|
||||
|
||||
private static MethodInfo[] GetCandidateMethods(Type type, string methodName, BindingFlags bindingFlags, int argCount)
|
||||
private static IList<MethodInfo> GetCandidateMethods(Type type, string methodName, BindingFlags bindingFlags, int argCount)
|
||||
{
|
||||
MethodInfo[] methods = type.GetMethods(bindingFlags | BindingFlags.FlattenHierarchy);
|
||||
List<MethodInfo> matches = new List<MethodInfo>();
|
||||
@@ -270,7 +270,7 @@ namespace Spring.Expressions
|
||||
}
|
||||
}
|
||||
|
||||
return matches.ToArray();
|
||||
return matches;
|
||||
}
|
||||
|
||||
// used to calculate signature hash while caring for arg positions
|
||||
|
||||
@@ -107,8 +107,7 @@ namespace Spring.Objects.Factory.Attributes
|
||||
/// </returns>
|
||||
/// <exception cref="ObjectInitializationException">If a required property value has not been specified
|
||||
/// in the configuration metadata.</exception>
|
||||
public override IPropertyValues PostProcessPropertyValues(IPropertyValues pvs, PropertyInfo[] pis, object objectInstance,
|
||||
string objectName)
|
||||
public override IPropertyValues PostProcessPropertyValues(IPropertyValues pvs, IList<PropertyInfo> pis, object objectInstance, string objectName)
|
||||
{
|
||||
if (!validatedObjectNames.Contains(objectName))
|
||||
{
|
||||
@@ -124,7 +123,7 @@ namespace Spring.Objects.Factory.Attributes
|
||||
if (invalidProperties.Count != 0)
|
||||
{
|
||||
throw new ObjectInitializationException(
|
||||
BuildExceptionMessage(invalidProperties.ToArray(), objectName));
|
||||
BuildExceptionMessage(invalidProperties, objectName));
|
||||
}
|
||||
validatedObjectNames.Add(objectName);
|
||||
}
|
||||
@@ -154,9 +153,9 @@ namespace Spring.Objects.Factory.Attributes
|
||||
/// <param name="invalidProperties">The list of names of invalid properties.</param>
|
||||
/// <param name="objectName">Name of the object.</param>
|
||||
/// <returns>The exception message</returns>
|
||||
private string BuildExceptionMessage(string[] invalidProperties, ICloneable objectName)
|
||||
private string BuildExceptionMessage(IList<string> invalidProperties, ICloneable objectName)
|
||||
{
|
||||
int size = invalidProperties.Length;
|
||||
int size = invalidProperties.Count;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(size == 1 ? "Property" : "Properties");
|
||||
for (int i=0; i < size; i++)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Spring.Objects.Factory.Config {
|
||||
@@ -105,26 +106,25 @@ namespace Spring.Objects.Factory.Config {
|
||||
/// invoked on this object instance.</returns>
|
||||
bool PostProcessAfterInstantiation(object objectInstance, string objectName);
|
||||
|
||||
/// <summary>
|
||||
/// Post-process the given property values before the factory applies them
|
||||
/// to the given object.
|
||||
/// </summary>
|
||||
/// <remarks>Allows for checking whether all dependencies have been
|
||||
/// satisfied, for example based on a "Required" annotation on bean property setters.
|
||||
/// <para>Also allows for replacing the property values to apply, typically through
|
||||
/// creating a new MutablePropertyValues instance based on the original PropertyValues,
|
||||
/// adding or removing specific values.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <param name="pvs">The property values that the factory is about to apply (never <code>null</code>).</param>
|
||||
/// <param name="pis">he relevant property infos for the target object (with ignored
|
||||
/// dependency types - which the factory handles specifically - already filtered out)</param>
|
||||
/// <param name="objectInstance">The object instance created, but whose properties have not yet
|
||||
/// been set.</param>
|
||||
/// <param name="objectName">Name of the object.</param>
|
||||
/// <returns>The actual property values to apply to the given object (can be the
|
||||
/// passed-in PropertyValues instances0 or null to skip property population.</returns>
|
||||
IPropertyValues PostProcessPropertyValues(IPropertyValues pvs, PropertyInfo[] pis, object objectInstance,
|
||||
string objectName);
|
||||
/// <summary>
|
||||
/// Post-process the given property values before the factory applies them
|
||||
/// to the given object.
|
||||
/// </summary>
|
||||
/// <remarks>Allows for checking whether all dependencies have been
|
||||
/// satisfied, for example based on a "Required" annotation on bean property setters.
|
||||
/// <para>Also allows for replacing the property values to apply, typically through
|
||||
/// creating a new MutablePropertyValues instance based on the original PropertyValues,
|
||||
/// adding or removing specific values.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <param name="pvs">The property values that the factory is about to apply (never <code>null</code>).</param>
|
||||
/// <param name="pis">he relevant property infos for the target object (with ignored
|
||||
/// dependency types - which the factory handles specifically - already filtered out)</param>
|
||||
/// <param name="objectInstance">The object instance created, but whose properties have not yet
|
||||
/// been set.</param>
|
||||
/// <param name="objectName">Name of the object.</param>
|
||||
/// <returns>The actual property values to apply to the given object (can be the
|
||||
/// passed-in PropertyValues instances0 or null to skip property population.</returns>
|
||||
IPropertyValues PostProcessPropertyValues(IPropertyValues pvs, IList<PropertyInfo> pis, object objectInstance, string objectName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -178,7 +179,7 @@ namespace Spring.Objects.Factory.Config
|
||||
/// preparation on startup.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
string[] DependsOn { get; }
|
||||
IList<string> DependsOn { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the initializer method.
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Spring.Objects.Factory.Config
|
||||
{
|
||||
/// <summary>
|
||||
@@ -138,7 +140,7 @@ namespace Spring.Objects.Factory.Config
|
||||
/// <see cref="RegisterSingleton"/>
|
||||
/// <see cref="Spring.Objects.Factory.Support.IObjectDefinitionRegistry.GetObjectDefinitionNames"/>
|
||||
/// <see cref="Spring.Objects.Factory.IListableObjectFactory.GetObjectDefinitionNames"/>
|
||||
string[] SingletonNames
|
||||
IList<string> SingletonNames
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Spring.Objects.Factory.Config
|
||||
@@ -153,8 +154,7 @@ namespace Spring.Objects.Factory.Config
|
||||
/// <param name="objectName">Name of the object.</param>
|
||||
/// <returns>The actual property values to apply to the given object (can be the
|
||||
/// passed-in PropertyValues instances0 or null to skip property population.</returns>
|
||||
public virtual IPropertyValues PostProcessPropertyValues(IPropertyValues pvs, PropertyInfo[] pis, object objectInstance,
|
||||
string objectName)
|
||||
public virtual IPropertyValues PostProcessPropertyValues(IPropertyValues pvs, IList<PropertyInfo> pis, object objectInstance, string objectName)
|
||||
{
|
||||
return pvs;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using Spring.Objects.Factory.Config;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Spring.Objects.Factory.Xml;
|
||||
using Spring.Util;
|
||||
|
||||
@@ -56,7 +57,7 @@ namespace Spring.Objects.Factory.Config
|
||||
{
|
||||
private IObjectDefinition objectDefinition;
|
||||
private string objectName;
|
||||
private string[] aliases;
|
||||
private IList<string> aliases;
|
||||
|
||||
#region Constructor () / Destructor
|
||||
|
||||
@@ -87,11 +88,11 @@ namespace Spring.Objects.Factory.Config
|
||||
/// Any aliases for the supplied <paramref name="definition"/>
|
||||
/// </param>
|
||||
public ObjectDefinitionHolder(
|
||||
IObjectDefinition definition, string name, string[] aliases)
|
||||
IObjectDefinition definition, string name, IList<string> aliases)
|
||||
{
|
||||
this.objectDefinition = definition;
|
||||
this.objectName = name;
|
||||
this.aliases = aliases == null ? StringUtils.EmptyStrings : aliases;
|
||||
this.aliases = aliases ?? new List<string>(0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -126,7 +127,7 @@ namespace Spring.Objects.Factory.Config
|
||||
/// <see cref="System.String"/> array will be returned.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
public string[] Aliases
|
||||
public IList<string> Aliases
|
||||
{
|
||||
get { return aliases; }
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace Spring.Objects.Factory.Config
|
||||
MutablePropertyValues pvs = objectDefinition.PropertyValues;
|
||||
if (pvs != null)
|
||||
{
|
||||
for (int j = 0; j < pvs.PropertyValues.Length; j++)
|
||||
for (int j = 0; j < pvs.PropertyValues.Count; j++)
|
||||
{
|
||||
PropertyValue pv = pvs.PropertyValues[j];
|
||||
object newVal = ResolveValue(pv.Value);
|
||||
|
||||
@@ -21,10 +21,12 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Globalization;
|
||||
|
||||
using Common.Logging;
|
||||
|
||||
using Spring.Collections;
|
||||
|
||||
#endregion
|
||||
@@ -228,10 +230,10 @@ namespace Spring.Objects.Factory.Config
|
||||
protected override void ProcessProperties(IConfigurableListableObjectFactory factory, NameValueCollection props)
|
||||
{
|
||||
PlaceholderResolveHandlerAdapter resolveAdapter = new PlaceholderResolveHandlerAdapter(this, props);
|
||||
ObjectDefinitionVisitor visitor = new ObjectDefinitionVisitor(new ObjectDefinitionVisitor.ResolveHandler(resolveAdapter.ParseAndResolveVariables));
|
||||
ObjectDefinitionVisitor visitor = new ObjectDefinitionVisitor(resolveAdapter.ParseAndResolveVariables);
|
||||
|
||||
string[] objectDefinitionNames = factory.GetObjectDefinitionNames();
|
||||
for (int i = 0; i < objectDefinitionNames.Length; ++i)
|
||||
IList<string> objectDefinitionNames = factory.GetObjectDefinitionNames();
|
||||
for (int i = 0; i < objectDefinitionNames.Count; ++i)
|
||||
{
|
||||
string name = objectDefinitionNames[i];
|
||||
IObjectDefinition definition = factory.GetObjectDefinition(name);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Common.Logging;
|
||||
using Spring.Collections;
|
||||
@@ -245,8 +246,8 @@ namespace Spring.Objects.Factory.Config
|
||||
TextProcessor tp = new TextProcessor(this, compositeVariableSource);
|
||||
ObjectDefinitionVisitor visitor = new ObjectDefinitionVisitor(new ObjectDefinitionVisitor.ResolveHandler(tp.ParseAndResolveVariables));
|
||||
|
||||
string[] objectDefinitionNames = factory.GetObjectDefinitionNames();
|
||||
for (int i = 0; i < objectDefinitionNames.Length; ++i)
|
||||
IList<string> objectDefinitionNames = factory.GetObjectDefinitionNames();
|
||||
for (int i = 0; i < objectDefinitionNames.Count; ++i)
|
||||
{
|
||||
string name = objectDefinitionNames[i];
|
||||
IObjectDefinition definition = factory.GetObjectDefinition( name );
|
||||
|
||||
@@ -86,141 +86,141 @@ namespace Spring.Objects.Factory
|
||||
/// </value>
|
||||
int ObjectDefinitionCount { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Return the names of all objects defined in this factory.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
string[] GetObjectDefinitionNames();
|
||||
|
||||
/// <summary>
|
||||
/// Return the names of objects matching the given <see cref="System.Type"/>
|
||||
/// (including subclasses), judging from the object definitions.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// Does consider objects created by <see cref="Spring.Objects.Factory.IFactoryObject"/>s,
|
||||
/// or rather it considers the type of objects created by
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/> (which means that
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/>s will be instantiated).
|
||||
/// </p>
|
||||
/// <p>
|
||||
/// Does not consider any hierarchy this factory may participate in.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
/// <param name="type">
|
||||
/// The <see cref="System.Type"/> (class or interface) to match, or <see langword="null"/>
|
||||
/// for all object names.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
string[] GetObjectNamesForType(Type type);
|
||||
/// <summary>
|
||||
/// Return the names of all objects defined in this factory.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
IList<string> GetObjectDefinitionNames();
|
||||
|
||||
/// <summary>
|
||||
/// Return the names of objects matching the given <see cref="System.Type"/>
|
||||
/// (including subclasses), judging from the object definitions.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// Does consider objects created by <see cref="Spring.Objects.Factory.IFactoryObject"/>s,
|
||||
/// or rather it considers the type of objects created by
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/> (which means that
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/>s will be instantiated).
|
||||
/// </p>
|
||||
/// <p>
|
||||
/// Does not consider any hierarchy this factory may participate in.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
/// <param name="type">
|
||||
/// The <see cref="System.Type"/> (class or interface) to match, or <see langword="null"/>
|
||||
/// for all object names.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
IList<string> GetObjectNamesForType(Type type);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Return the names of objects matching the given <see cref="System.Type"/>
|
||||
/// (including subclasses), judging from the object definitions.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// Does consider objects created by <see cref="Spring.Objects.Factory.IFactoryObject"/>s,
|
||||
/// or rather it considers the type of objects created by
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/> (which means that
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/>s will be instantiated).
|
||||
/// </p>
|
||||
/// <p>
|
||||
/// Does not consider any hierarchy this factory may participate in.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
/// <typeparam name="T">
|
||||
/// The <see cref="System.Type"/> (class or interface) to match, or <see langword="null"/>
|
||||
/// for all object names.
|
||||
/// </typeparam>
|
||||
/// <returns>
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
string[] GetObjectNamesForType<T>();
|
||||
/// <summary>
|
||||
/// Return the names of objects matching the given <see cref="System.Type"/>
|
||||
/// (including subclasses), judging from the object definitions.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// Does consider objects created by <see cref="Spring.Objects.Factory.IFactoryObject"/>s,
|
||||
/// or rather it considers the type of objects created by
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/> (which means that
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/>s will be instantiated).
|
||||
/// </p>
|
||||
/// <p>
|
||||
/// Does not consider any hierarchy this factory may participate in.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
/// <typeparam name="T">
|
||||
/// The <see cref="System.Type"/> (class or interface) to match, or <see langword="null"/>
|
||||
/// for all object names.
|
||||
/// </typeparam>
|
||||
/// <returns>
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
IList<string> GetObjectNames<T>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Return the names of objects matching the given <see cref="System.Type"/>
|
||||
/// (including subclasses), judging from the object definitions.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// Does consider objects created by <see cref="Spring.Objects.Factory.IFactoryObject"/>s,
|
||||
/// or rather it considers the type of objects created by
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/> (which means that
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/>s will be instantiated).
|
||||
/// </p>
|
||||
/// <p>
|
||||
/// Does not consider any hierarchy this factory may participate in.
|
||||
/// Use <see cref="ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(Spring.Objects.Factory.IListableObjectFactory,System.Type,bool,bool)"/>
|
||||
/// to include beans in ancestor factories too.
|
||||
/// <p>Note: Does <i>not</i> ignore singleton objects that have been registered
|
||||
/// by other means than bean definitions.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
/// <param name="type">
|
||||
/// The <see cref="System.Type"/> (class or interface) to match, or <see langword="null"/>
|
||||
/// for all object names.
|
||||
/// </param>
|
||||
/// <param name="includePrototypes">
|
||||
/// Whether to include prototype objects too or just singletons (also applies to
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/>s).
|
||||
/// </param>
|
||||
/// <param name="includeFactoryObjects">
|
||||
/// Whether to include <see cref="Spring.Objects.Factory.IFactoryObject"/>s too
|
||||
/// or just normal objects.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
string[] GetObjectNamesForType(Type type, bool includePrototypes, bool includeFactoryObjects);
|
||||
/// <summary>
|
||||
/// Return the names of objects matching the given <see cref="System.Type"/>
|
||||
/// (including subclasses), judging from the object definitions.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// Does consider objects created by <see cref="Spring.Objects.Factory.IFactoryObject"/>s,
|
||||
/// or rather it considers the type of objects created by
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/> (which means that
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/>s will be instantiated).
|
||||
/// </p>
|
||||
/// <p>
|
||||
/// Does not consider any hierarchy this factory may participate in.
|
||||
/// Use <see cref="ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(Spring.Objects.Factory.IListableObjectFactory,System.Type,bool,bool)"/>
|
||||
/// to include beans in ancestor factories too.
|
||||
/// <p>Note: Does <i>not</i> ignore singleton objects that have been registered
|
||||
/// by other means than bean definitions.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
/// <param name="type">
|
||||
/// The <see cref="System.Type"/> (class or interface) to match, or <see langword="null"/>
|
||||
/// for all object names.
|
||||
/// </param>
|
||||
/// <param name="includePrototypes">
|
||||
/// Whether to include prototype objects too or just singletons (also applies to
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/>s).
|
||||
/// </param>
|
||||
/// <param name="includeFactoryObjects">
|
||||
/// Whether to include <see cref="Spring.Objects.Factory.IFactoryObject"/>s too
|
||||
/// or just normal objects.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
IList<string> GetObjectNamesForType(Type type, bool includePrototypes, bool includeFactoryObjects);
|
||||
|
||||
/// <summary>
|
||||
/// Return the names of objects matching the given <see cref="System.Type"/>
|
||||
/// (including subclasses), judging from the object definitions.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// Does consider objects created by <see cref="Spring.Objects.Factory.IFactoryObject"/>s,
|
||||
/// or rather it considers the type of objects created by
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/> (which means that
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/>s will be instantiated).
|
||||
/// </p>
|
||||
/// <p>
|
||||
/// Does not consider any hierarchy this factory may participate in.
|
||||
/// Use <see cref="ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(Spring.Objects.Factory.IListableObjectFactory,System.Type,bool,bool)"/>
|
||||
/// to include beans in ancestor factories too.
|
||||
/// <p>Note: Does <i>not</i> ignore singleton objects that have been registered
|
||||
/// by other means than bean definitions.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
/// <typeparam name="T">
|
||||
/// The <see cref="System.Type"/> (class or interface) to match, or <see langword="null"/>
|
||||
/// for all object names.
|
||||
/// </typeparam>
|
||||
/// <param name="includePrototypes">
|
||||
/// Whether to include prototype objects too or just singletons (also applies to
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/>s).
|
||||
/// </param>
|
||||
/// <param name="includeFactoryObjects">
|
||||
/// Whether to include <see cref="Spring.Objects.Factory.IFactoryObject"/>s too
|
||||
/// or just normal objects.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
string[] GetObjectNamesForType<T>(bool includePrototypes, bool includeFactoryObjects);
|
||||
/// <summary>
|
||||
/// Return the names of objects matching the given <see cref="System.Type"/>
|
||||
/// (including subclasses), judging from the object definitions.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// Does consider objects created by <see cref="Spring.Objects.Factory.IFactoryObject"/>s,
|
||||
/// or rather it considers the type of objects created by
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/> (which means that
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/>s will be instantiated).
|
||||
/// </p>
|
||||
/// <p>
|
||||
/// Does not consider any hierarchy this factory may participate in.
|
||||
/// Use <see cref="ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(Spring.Objects.Factory.IListableObjectFactory,System.Type,bool,bool)"/>
|
||||
/// to include beans in ancestor factories too.
|
||||
/// <p>Note: Does <i>not</i> ignore singleton objects that have been registered
|
||||
/// by other means than bean definitions.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
/// <typeparam name="T">
|
||||
/// The <see cref="System.Type"/> (class or interface) to match, or <see langword="null"/>
|
||||
/// for all object names.
|
||||
/// </typeparam>
|
||||
/// <param name="includePrototypes">
|
||||
/// Whether to include prototype objects too or just singletons (also applies to
|
||||
/// <see cref="Spring.Objects.Factory.IFactoryObject"/>s).
|
||||
/// </param>
|
||||
/// <param name="includeFactoryObjects">
|
||||
/// Whether to include <see cref="Spring.Objects.Factory.IFactoryObject"/>s too
|
||||
/// or just normal objects.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
IList<string> GetObjectNames<T>(bool includePrototypes, bool includeFactoryObjects);
|
||||
|
||||
/// <summary>
|
||||
/// Return the object instances that match the given object
|
||||
@@ -278,7 +278,7 @@ namespace Spring.Objects.Factory
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// If the objects could not be created.
|
||||
/// </exception>
|
||||
IDictionary<string, T> GetObjectsOfType<T>();
|
||||
IDictionary<string, T> GetObjects<T>();
|
||||
|
||||
/// <summary>
|
||||
/// Return the object instances that match the given object
|
||||
@@ -334,7 +334,7 @@ namespace Spring.Objects.Factory
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// If the objects could not be created.
|
||||
/// </exception>
|
||||
IDictionary<string, T> GetObjectsOfType<T>(bool includePrototypes, bool includeFactoryObjects);
|
||||
IDictionary<string, T> GetObjects<T>(bool includePrototypes, bool includeFactoryObjects);
|
||||
|
||||
/// <summary>
|
||||
/// Return an instance (possibly shared or independent) of the given object name.
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -209,21 +210,21 @@ namespace Spring.Objects.Factory
|
||||
/// <returns>True if an object with the given name is defined.</returns>
|
||||
bool ContainsObject(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Return the aliases for the given object name, if defined.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Will ask the parent factory if the object cannot be found in this factory
|
||||
/// instance.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <param name="name">The object name to check for aliases.</param>
|
||||
/// <returns>The aliases, or an empty array if none.</returns>
|
||||
/// <exception cref="Spring.Objects.Factory.NoSuchObjectDefinitionException">
|
||||
/// If there's no such object definition.
|
||||
/// </exception>
|
||||
string[] GetAliases(string name);
|
||||
/// <summary>
|
||||
/// Return the aliases for the given object name, if defined.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Will ask the parent factory if the object cannot be found in this factory
|
||||
/// instance.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <param name="name">The object name to check for aliases.</param>
|
||||
/// <returns>The aliases, or an empty array if none.</returns>
|
||||
/// <exception cref="Spring.Objects.Factory.NoSuchObjectDefinitionException">
|
||||
/// If there's no such object definition.
|
||||
/// </exception>
|
||||
IList<string> GetAliases(string name);
|
||||
|
||||
#if !MONO
|
||||
/// <summary>
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace Spring.Objects.Factory
|
||||
/// </returns>
|
||||
public static int CountObjectsIncludingAncestors(IListableObjectFactory factory)
|
||||
{
|
||||
return ObjectNamesIncludingAncestors(factory).Length;
|
||||
return ObjectNamesIncludingAncestors(factory).Count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -119,7 +119,7 @@ namespace Spring.Objects.Factory
|
||||
/// </summary>
|
||||
/// <param name="factory">The object factory.</param>
|
||||
/// <returns>The array of object names, or an empty array if none.</returns>
|
||||
public static string[] ObjectNamesIncludingAncestors(IListableObjectFactory factory)
|
||||
public static IList<string> ObjectNamesIncludingAncestors(IListableObjectFactory factory)
|
||||
{
|
||||
return ObjectNamesForTypeIncludingAncestors(factory, typeof(object));
|
||||
}
|
||||
@@ -159,7 +159,7 @@ namespace Spring.Objects.Factory
|
||||
/// <returns>
|
||||
/// The array of object names, or an empty array if none.
|
||||
/// </returns>
|
||||
public static string[] ObjectNamesForTypeIncludingAncestors(
|
||||
public static IList<string> ObjectNamesForTypeIncludingAncestors(
|
||||
IListableObjectFactory factory, Type type,
|
||||
bool includePrototypes, bool includeFactoryObjects)
|
||||
{
|
||||
@@ -169,7 +169,7 @@ namespace Spring.Objects.Factory
|
||||
if (pof != null)
|
||||
{
|
||||
IHierarchicalObjectFactory hof = (IHierarchicalObjectFactory)factory;
|
||||
string[] parentsResult = ObjectNamesForTypeIncludingAncestors(pof, type, includePrototypes, includeFactoryObjects);
|
||||
IList<string> parentsResult = ObjectNamesForTypeIncludingAncestors(pof, type, includePrototypes, includeFactoryObjects);
|
||||
foreach (string objectName in parentsResult)
|
||||
{
|
||||
if (!result.Contains(objectName) && !hof.ContainsLocalObject(objectName))
|
||||
@@ -178,7 +178,7 @@ namespace Spring.Objects.Factory
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.ToArray();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -209,7 +209,7 @@ namespace Spring.Objects.Factory
|
||||
/// <returns>
|
||||
/// The array of object names, or an empty array if none.
|
||||
/// </returns>
|
||||
public static string[] ObjectNamesForTypeIncludingAncestors(
|
||||
public static IList<string> ObjectNamesForTypeIncludingAncestors(
|
||||
IListableObjectFactory factory, Type type)
|
||||
{
|
||||
List<string> result = new List<string>();
|
||||
@@ -218,7 +218,7 @@ namespace Spring.Objects.Factory
|
||||
if (pof != null)
|
||||
{
|
||||
IHierarchicalObjectFactory hof = (IHierarchicalObjectFactory)factory;
|
||||
string[] parentsResult = ObjectNamesForTypeIncludingAncestors(pof, type);
|
||||
IList<string> parentsResult = ObjectNamesForTypeIncludingAncestors(pof, type);
|
||||
foreach (string objectName in parentsResult)
|
||||
{
|
||||
if (!result.Contains(objectName) && !hof.ContainsLocalObject(objectName))
|
||||
@@ -227,7 +227,7 @@ namespace Spring.Objects.Factory
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.ToArray();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -349,15 +349,15 @@ namespace Spring.Objects.Factory.Support
|
||||
/// </remarks>
|
||||
protected void ApplyPropertyValues(string name, RootObjectDefinition definition, IObjectWrapper wrapper, IPropertyValues properties)
|
||||
{
|
||||
if (properties == null || properties.PropertyValues.Length == 0)
|
||||
if (properties == null || properties.PropertyValues.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ObjectDefinitionValueResolver valueResolver = CreateValueResolver();
|
||||
|
||||
MutablePropertyValues deepCopy = new MutablePropertyValues(properties);
|
||||
PropertyValue[] copiedProperties = deepCopy.PropertyValues;
|
||||
for (int i = 0; i < copiedProperties.Length; ++i)
|
||||
IList<PropertyValue> copiedProperties = deepCopy.PropertyValues;
|
||||
for (int i = 0; i < copiedProperties.Count; ++i)
|
||||
{
|
||||
PropertyValue copiedProperty = copiedProperties[i];
|
||||
//(string name, RootObjectDefinition definition, string argumentName, object argumentValue)
|
||||
@@ -500,7 +500,7 @@ namespace Spring.Objects.Factory.Support
|
||||
|
||||
if (wrapper == null)
|
||||
{
|
||||
if (properties.PropertyValues.Length > 0)
|
||||
if (properties.PropertyValues.Count > 0)
|
||||
{
|
||||
throw new ObjectCreationException(definition.ResourceDescription,
|
||||
name, "Cannot apply property values to null instance.");
|
||||
@@ -534,7 +534,7 @@ namespace Spring.Objects.Factory.Support
|
||||
|
||||
if (hasInstAwareOpps || needsDepCheck)
|
||||
{
|
||||
PropertyInfo[] filteredPropInfo = FilterPropertyInfoForDependencyCheck(wrapper);
|
||||
IList<PropertyInfo> filteredPropInfo = FilterPropertyInfoForDependencyCheck(wrapper);
|
||||
if (hasInstAwareOpps)
|
||||
{
|
||||
foreach (IObjectPostProcessor processor in ObjectPostProcessors)
|
||||
@@ -834,7 +834,7 @@ namespace Spring.Objects.Factory.Support
|
||||
protected internal override object InstantiateObject(string name, RootObjectDefinition definition, object[] arguments, bool allowEagerCaching, bool suppressConfigure)
|
||||
{
|
||||
// guarantee the initialization of objects that the current one depends on..
|
||||
if (definition.DependsOn != null && definition.DependsOn.Length > 0)
|
||||
if (definition.DependsOn != null && definition.DependsOn.Count > 0)
|
||||
{
|
||||
foreach (string dependant in definition.DependsOn)
|
||||
{
|
||||
@@ -1155,7 +1155,7 @@ namespace Spring.Objects.Factory.Support
|
||||
return;
|
||||
}
|
||||
|
||||
PropertyInfo[] filteredPropInfo = FilterPropertyInfoForDependencyCheck(wrapper);
|
||||
IList<PropertyInfo> filteredPropInfo = FilterPropertyInfoForDependencyCheck(wrapper);
|
||||
if (HasInstantiationAwareBeanPostProcessors)
|
||||
{
|
||||
foreach (IObjectPostProcessor processor in ObjectPostProcessors)
|
||||
@@ -1177,12 +1177,12 @@ namespace Spring.Objects.Factory.Support
|
||||
CheckDependencies(name, definition, filteredPropInfo, properties);
|
||||
}
|
||||
|
||||
private void CheckDependencies(string name, IConfigurableObjectDefinition definition, PropertyInfo[] filteredPropInfo, IPropertyValues properties)
|
||||
private void CheckDependencies(string name, IConfigurableObjectDefinition definition, IList<PropertyInfo> filteredPropInfo, IPropertyValues properties)
|
||||
{
|
||||
DependencyCheckingMode dependencyCheck = definition.DependencyCheck;
|
||||
PropertyInfo[] unsatisfiedDependencies = AutowireUtils.GetUnsatisfiedDependencies(filteredPropInfo, properties, dependencyCheck);
|
||||
IList<PropertyInfo> unsatisfiedDependencies = AutowireUtils.GetUnsatisfiedDependencies(filteredPropInfo, properties, dependencyCheck);
|
||||
|
||||
if (unsatisfiedDependencies.Length > 0)
|
||||
if (unsatisfiedDependencies.Count > 0)
|
||||
{
|
||||
throw new UnsatisfiedDependencyException(definition.ResourceDescription, name, unsatisfiedDependencies[0].Name,
|
||||
"Set this property value or disable dependency checking for this object.");
|
||||
@@ -1195,11 +1195,11 @@ namespace Spring.Objects.Factory.Support
|
||||
/// </summary>
|
||||
/// <param name="wrapper">The object wrapper the object was created with.</param>
|
||||
/// <returns>The filtered PropertyInfos</returns>
|
||||
private PropertyInfo[] FilterPropertyInfoForDependencyCheck(IObjectWrapper wrapper)
|
||||
private IList<PropertyInfo> FilterPropertyInfoForDependencyCheck(IObjectWrapper wrapper)
|
||||
{
|
||||
lock (filteredPropertyDescriptorsCache)
|
||||
{
|
||||
PropertyInfo[] filtered;
|
||||
IList<PropertyInfo> filtered;
|
||||
if (!filteredPropertyDescriptorsCache.TryGetValue(wrapper.WrappedType, out filtered))
|
||||
{
|
||||
|
||||
@@ -1213,7 +1213,7 @@ namespace Spring.Objects.Factory.Support
|
||||
}
|
||||
}
|
||||
|
||||
filtered = list.ToArray();
|
||||
filtered = list;
|
||||
filteredPropertyDescriptorsCache.Add(wrapper.WrappedType, filtered);
|
||||
}
|
||||
return filtered;
|
||||
@@ -1461,7 +1461,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// </param>
|
||||
private void DestroyDependantObjects(string name)
|
||||
{
|
||||
string[] dependingObjects = GetDependingObjectNames(name);
|
||||
IList<string> dependingObjects = GetDependingObjectNames(name);
|
||||
foreach (string doName in dependingObjects)
|
||||
{
|
||||
DestroySingleton(doName);
|
||||
@@ -1769,7 +1769,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// In case of errors.
|
||||
/// </exception>
|
||||
protected abstract string[] GetDependingObjectNames(string name);
|
||||
protected abstract IList<string> GetDependingObjectNames(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Injects dependencies into the supplied <paramref name="target"/> instance
|
||||
@@ -2080,7 +2080,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// <summary>
|
||||
/// Cache of filtered PropertyInfos: object Type -> PropertyInfo array
|
||||
/// </summary>
|
||||
private IDictionary<Type, PropertyInfo[]> filteredPropertyDescriptorsCache = new Dictionary<Type, PropertyInfo[]>();
|
||||
private IDictionary<Type, IList<PropertyInfo>> filteredPropertyDescriptorsCache = new Dictionary<Type, IList<PropertyInfo>>();
|
||||
|
||||
/// <summary>
|
||||
/// Dependency interfaces to ignore on dependency check and autowire, as Set of
|
||||
|
||||
@@ -21,12 +21,11 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Spring.Core;
|
||||
|
||||
using Spring.Core.TypeResolution;
|
||||
using Spring.Objects.Factory.Config;
|
||||
using Spring.Util;
|
||||
@@ -135,9 +134,8 @@ namespace Spring.Objects.Factory.Support
|
||||
|
||||
InitMethodName = other.InitMethodName;
|
||||
DestroyMethodName = other.DestroyMethodName;
|
||||
DependsOn = new string[other.DependsOn.Length];
|
||||
IsAutowireCandidate = other.IsAutowireCandidate;
|
||||
Array.Copy(other.DependsOn, DependsOn, other.DependsOn.Length);
|
||||
DependsOn = new List<string>(other.DependsOn);
|
||||
FactoryMethodName = other.FactoryMethodName;
|
||||
FactoryObjectName = other.FactoryObjectName;
|
||||
AutowireMode = other.AutowireMode;
|
||||
@@ -524,10 +522,10 @@ namespace Spring.Objects.Factory.Support
|
||||
/// preparation on startup.
|
||||
/// </note>
|
||||
/// </remarks>
|
||||
public string[] DependsOn
|
||||
public IList<string> DependsOn
|
||||
{
|
||||
get { return dependsOn; }
|
||||
set { dependsOn = value == null ? StringUtils.EmptyStrings : value; }
|
||||
set { dependsOn = value ?? StringUtils.EmptyStrings; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -739,14 +737,14 @@ namespace Spring.Objects.Factory.Support
|
||||
{
|
||||
FactoryMethodName = other.FactoryMethodName;
|
||||
}
|
||||
if (ArrayUtils.HasLength(other.DependsOn))
|
||||
if (other.DependsOn != null && other.DependsOn.Count > 0)
|
||||
{
|
||||
List<string> deps = new List<string>(other.DependsOn);
|
||||
if (ArrayUtils.HasLength(DependsOn))
|
||||
if (DependsOn != null && DependsOn.Count > 0)
|
||||
{
|
||||
deps.AddRange(DependsOn);
|
||||
}
|
||||
DependsOn = deps.ToArray();
|
||||
DependsOn = deps;
|
||||
}
|
||||
AutowireMode = other.AutowireMode;
|
||||
ResourceDescription = other.ResourceDescription;
|
||||
@@ -811,7 +809,7 @@ namespace Spring.Objects.Factory.Support
|
||||
private object objectType;
|
||||
private AutoWiringMode autowireMode = AutoWiringMode.No;
|
||||
private DependencyCheckingMode dependencyCheck = DependencyCheckingMode.None;
|
||||
private string[] dependsOn;
|
||||
private IList<string> dependsOn;
|
||||
private bool autowireCandidate = true;
|
||||
private string initMethodName = null;
|
||||
private string destroyMethodName = null;
|
||||
|
||||
@@ -29,7 +29,6 @@ using System.ComponentModel;
|
||||
using Common.Logging;
|
||||
|
||||
using Spring.Collections;
|
||||
using Spring.Collections.Generic;
|
||||
using Spring.Core;
|
||||
using Spring.Core.TypeConversion;
|
||||
using Spring.Objects.Factory.Config;
|
||||
@@ -1211,7 +1210,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// The names of objects in the singleton cache that match the given
|
||||
/// object type (including subclasses), or an empty array if none.
|
||||
/// </returns>
|
||||
public virtual string[] GetSingletonNames(Type type)
|
||||
public virtual IList<string> GetSingletonNames(Type type)
|
||||
{
|
||||
lock (singletonCache)
|
||||
{
|
||||
@@ -1225,7 +1224,7 @@ namespace Spring.Objects.Factory.Support
|
||||
matches.Add(name);
|
||||
}
|
||||
}
|
||||
return matches.ToArray();
|
||||
return matches;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1448,12 +1447,12 @@ namespace Spring.Objects.Factory.Support
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
/// <returns>The names of the objects in the singleton cache.</returns>
|
||||
public virtual string[] GetSingletonNames()
|
||||
public virtual IList<string> GetSingletonNames()
|
||||
{
|
||||
lock (singletonCache)
|
||||
{
|
||||
IEnumerable<string> keys = singletonCache.Keys.Cast<string>();
|
||||
return new List<string>(keys).ToArray();
|
||||
return new List<string>(keys);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1622,7 +1621,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// <summary>
|
||||
/// Set of registered singletons, containing the bean names in registration order
|
||||
/// </summary>
|
||||
private ISet registeredSingletons = new HashedSet();
|
||||
private HashSet<string> registeredSingletons = new HashSet<string>();
|
||||
|
||||
private readonly IDictionary singletonsInCreation;
|
||||
|
||||
@@ -1815,7 +1814,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// Return the aliases for the given object name, if defined.
|
||||
/// </summary>
|
||||
/// <see cref="Spring.Objects.Factory.IObjectFactory.GetAliases"/>.
|
||||
public string[] GetAliases(string name)
|
||||
public IList<string> GetAliases(string name)
|
||||
{
|
||||
string objectName = TransformedObjectName(name);
|
||||
// check if object actually exists in this object factory...
|
||||
@@ -1834,7 +1833,7 @@ namespace Spring.Objects.Factory.Support
|
||||
}
|
||||
}
|
||||
}
|
||||
return matches.ToArray();
|
||||
return matches;
|
||||
}
|
||||
|
||||
// not found, so check parent...
|
||||
@@ -2534,7 +2533,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// <see cref="RegisterSingleton"/>
|
||||
/// <see cref="Spring.Objects.Factory.Support.IObjectDefinitionRegistry.GetObjectDefinitionNames"/>
|
||||
/// <see cref="Spring.Objects.Factory.IListableObjectFactory.GetObjectDefinitionNames"/>
|
||||
public string[] SingletonNames
|
||||
public IList<string> SingletonNames
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
@@ -24,10 +24,10 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
using Spring.Collections;
|
||||
using Spring.Core;
|
||||
using Spring.Objects.Factory.Config;
|
||||
using Spring.Objects.Support;
|
||||
using Spring.Util;
|
||||
|
||||
#endregion
|
||||
@@ -355,7 +355,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// 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)
|
||||
public static IList<PropertyInfo> GetUnsatisfiedDependencies(IList<PropertyInfo> propertyInfos, IPropertyValues properties, DependencyCheckingMode dependencyCheck)
|
||||
{
|
||||
List<PropertyInfo> unsatisfiedDependenciesList = new List<PropertyInfo>();
|
||||
foreach (PropertyInfo property in propertyInfos)
|
||||
@@ -371,7 +371,7 @@ namespace Spring.Objects.Factory.Support
|
||||
}
|
||||
}
|
||||
}
|
||||
return unsatisfiedDependenciesList.ToArray();
|
||||
return unsatisfiedDependenciesList;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,8 @@ using Spring.Core.TypeResolution;
|
||||
using Spring.Objects.Factory.Config;
|
||||
using Spring.Util;
|
||||
|
||||
using System.Linq;
|
||||
|
||||
namespace Spring.Objects.Factory.Support
|
||||
{
|
||||
/// <summary>
|
||||
@@ -307,12 +309,12 @@ namespace Spring.Objects.Factory.Support
|
||||
}
|
||||
|
||||
GenericArgumentsHolder genericArgsInfo = new GenericArgumentsHolder(definition.FactoryMethodName);
|
||||
MethodInfo[] factoryMethodCandidates = FindMethods(genericArgsInfo.GenericMethodName, expectedArgCount, isStatic, factoryClass);
|
||||
IList<MethodInfo> factoryMethodCandidates = FindMethods(genericArgsInfo.GenericMethodName, expectedArgCount, isStatic, factoryClass);
|
||||
|
||||
bool autowiring = (definition.AutowireMode == AutoWiringMode.Constructor);
|
||||
|
||||
// try all matching methods to see if they match the constructor arguments...
|
||||
for (int i = 0; i < factoryMethodCandidates.Length; i++)
|
||||
for (int i = 0; i < factoryMethodCandidates.Count; i++)
|
||||
{
|
||||
MethodInfo factoryMethodCandidate = factoryMethodCandidates[i];
|
||||
if (genericArgsInfo.ContainsGenericArguments)
|
||||
@@ -610,16 +612,14 @@ namespace Spring.Objects.Factory.Support
|
||||
/// <see cref="System.Reflection.MethodInfo">methods</see> exposed on the
|
||||
/// <paramref name="searchType"/> that match the supplied criteria.
|
||||
/// </returns>
|
||||
private static MethodInfo[] FindMethods(string methodName, int expectedArgumentCount, bool isStatic, Type searchType)
|
||||
private static IList<MethodInfo> FindMethods(string methodName, int expectedArgumentCount, bool isStatic, Type searchType)
|
||||
{
|
||||
ComposedCriteria methodCriteria = new ComposedCriteria();
|
||||
methodCriteria.Add(new MethodNameMatchCriteria(methodName));
|
||||
methodCriteria.Add(new MethodParametersCountCriteria(expectedArgumentCount));
|
||||
BindingFlags methodFlags = BindingFlags.Public | BindingFlags.IgnoreCase | (isStatic ? BindingFlags.Static : BindingFlags.Instance);
|
||||
MemberInfo[] methods =
|
||||
searchType.FindMembers(MemberTypes.Method, methodFlags, new MemberFilter(new CriteriaMemberFilter().FilterMemberByCriteria),
|
||||
methodCriteria);
|
||||
return (MethodInfo[])ArrayList.Adapter(methods).ToArray(typeof(MethodInfo));
|
||||
MemberInfo[] methods = searchType.FindMembers(MemberTypes.Method, methodFlags, new CriteriaMemberFilter().FilterMemberByCriteria, methodCriteria);
|
||||
return methods.Cast<MethodInfo>().ToArray();
|
||||
}
|
||||
internal class ArgumentsHolder
|
||||
{
|
||||
|
||||
@@ -217,16 +217,15 @@ namespace Spring.Objects.Factory.Support
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// In case of errors.
|
||||
/// </exception>
|
||||
protected override string[] GetDependingObjectNames(string objectName)
|
||||
protected override IList<string> GetDependingObjectNames(string objectName)
|
||||
{
|
||||
List<string> dependingObjectNames = new List<string>();
|
||||
string[] allObjectDefinitionNames = GetObjectDefinitionNames();
|
||||
IList<string> allObjectDefinitionNames = GetObjectDefinitionNames();
|
||||
foreach (string name in allObjectDefinitionNames)
|
||||
{
|
||||
if (ContainsObjectDefinition(name))
|
||||
{
|
||||
RootObjectDefinition rod
|
||||
= GetMergedObjectDefinition(name, false);
|
||||
RootObjectDefinition rod = GetMergedObjectDefinition(name, false);
|
||||
if (rod.DependsOn != null)
|
||||
{
|
||||
HashSet<string> dependsOn = new HashSet<string>(rod.DependsOn);
|
||||
@@ -249,7 +248,7 @@ namespace Spring.Objects.Factory.Support
|
||||
}
|
||||
}
|
||||
}
|
||||
return dependingObjectNames.ToArray();
|
||||
return dependingObjectNames;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -604,9 +603,9 @@ namespace Spring.Objects.Factory.Support
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
/// <seealso cref="Spring.Objects.Factory.IListableObjectFactory.GetObjectDefinitionNames()"/>
|
||||
public string[] GetObjectDefinitionNames()
|
||||
public IList<string> GetObjectDefinitionNames()
|
||||
{
|
||||
return objectDefinitionNames.ToArray();
|
||||
return objectDefinitionNames;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -622,7 +621,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
/// <seealso cref="Spring.Objects.Factory.IListableObjectFactory.GetObjectDefinitionNames()"/>
|
||||
public string[] GetObjectDefinitionNames(Type type)
|
||||
public IList<string> GetObjectDefinitionNames(Type type)
|
||||
{
|
||||
List<string> matches = new List<string>();
|
||||
foreach (string name in objectDefinitionNames)
|
||||
@@ -632,7 +631,7 @@ namespace Spring.Objects.Factory.Support
|
||||
matches.Add(name);
|
||||
}
|
||||
}
|
||||
return matches.ToArray();
|
||||
return matches;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -648,7 +647,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
/// <seealso cref="Spring.Objects.Factory.IListableObjectFactory.GetObjectNamesForType(Type)"/>
|
||||
public string[] GetObjectNamesForType(Type type)
|
||||
public IList<string> GetObjectNamesForType(Type type)
|
||||
{
|
||||
return GetObjectNamesForType(type, true, true);
|
||||
}
|
||||
@@ -676,7 +675,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
public string[] GetObjectNamesForType<T>()
|
||||
public IList<string> GetObjectNames<T>()
|
||||
{
|
||||
return GetObjectNamesForType(typeof (T));
|
||||
}
|
||||
@@ -702,10 +701,10 @@ namespace Spring.Objects.Factory.Support
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
/// <seealso cref="Spring.Objects.Factory.IListableObjectFactory.GetObjectNamesForType(Type, bool, bool)"/>
|
||||
public string[] GetObjectNamesForType(Type type, bool includePrototypes, bool includeFactoryObjects)
|
||||
public IList<string> GetObjectNamesForType(Type type, bool includePrototypes, bool includeFactoryObjects)
|
||||
{
|
||||
List<string> objectNames = DoGetObjectNamesForType(type, includePrototypes, includeFactoryObjects);
|
||||
return objectNames.ToArray();
|
||||
return objectNames;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -743,7 +742,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
public string[] GetObjectNamesForType<T>(bool includePrototypes, bool includeFactoryObjects)
|
||||
public IList<string> GetObjectNames<T>(bool includePrototypes, bool includeFactoryObjects)
|
||||
{
|
||||
return GetObjectNamesForType(typeof (T), includePrototypes, includeFactoryObjects);
|
||||
}
|
||||
@@ -799,7 +798,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// If the objects could not be created.
|
||||
/// </exception>
|
||||
public IDictionary<string, T> GetObjectsOfType<T>()
|
||||
public IDictionary<string, T> GetObjects<T>()
|
||||
{
|
||||
Dictionary<string, T> result = new Dictionary<string, T>();
|
||||
DoGetObjectsOfType(typeof (T), true, true, result);
|
||||
@@ -896,7 +895,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// If the objects could not be created.
|
||||
/// </exception>
|
||||
public IDictionary<string, T> GetObjectsOfType<T>(bool includePrototypes, bool includeFactoryObjects)
|
||||
public IDictionary<string, T> GetObjects<T>(bool includePrototypes, bool includeFactoryObjects)
|
||||
{
|
||||
Dictionary<string, T> result = new Dictionary<string, T>();
|
||||
DoGetObjectsOfType(typeof (T), includePrototypes, includeFactoryObjects, result);
|
||||
@@ -934,13 +933,13 @@ namespace Spring.Objects.Factory.Support
|
||||
/// </exception>
|
||||
public T GetObject<T>()
|
||||
{
|
||||
string[] objectNamesForType = GetObjectNamesForType(typeof(T));
|
||||
if ((objectNamesForType == null) || (objectNamesForType.Length == 0))
|
||||
IList<string> objectNamesForType = GetObjectNamesForType(typeof(T));
|
||||
if ((objectNamesForType == null) || (objectNamesForType.Count == 0))
|
||||
{
|
||||
throw new NoSuchObjectDefinitionException(typeof(T).FullName, "Requested Type not Defined in the Context.");
|
||||
}
|
||||
|
||||
if (objectNamesForType.Length > 1)
|
||||
if (objectNamesForType.Count > 1)
|
||||
{
|
||||
throw new ObjectDefinitionStoreException(string.Format("More than one definition for {0} found in the Context.", typeof(T).FullName));
|
||||
}
|
||||
@@ -975,7 +974,7 @@ namespace Spring.Objects.Factory.Support
|
||||
protected List<string> DoGetObjectNamesForType(Type type, bool includeNonSingletons, bool allowEagerInit)
|
||||
{
|
||||
List<string> result = new List<string>();
|
||||
string[] objectNames = GetObjectDefinitionNames();
|
||||
IList<string> objectNames = GetObjectDefinitionNames();
|
||||
foreach (string s in objectNames)
|
||||
{
|
||||
string objectName = s;
|
||||
@@ -1033,7 +1032,7 @@ namespace Spring.Objects.Factory.Support
|
||||
}
|
||||
|
||||
// check singletons too, to catch manually registered singletons...
|
||||
string[] singletonNames = GetSingletonNames();
|
||||
IList<string> singletonNames = GetSingletonNames();
|
||||
foreach (string s in singletonNames)
|
||||
{
|
||||
string objectName = s;
|
||||
@@ -1170,9 +1169,9 @@ namespace Spring.Objects.Factory.Support
|
||||
|
||||
private IDictionary FindAutowireCandidates(string objectName, Type requiredType, DependencyDescriptor descriptor)
|
||||
{
|
||||
string[] candidateNames =
|
||||
IList<string> candidateNames =
|
||||
ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(this, requiredType, true, descriptor.Eager);
|
||||
IDictionary result = new OrderedDictionary(candidateNames.Length);
|
||||
IDictionary result = new OrderedDictionary(candidateNames.Count);
|
||||
|
||||
foreach (DictionaryEntry entry in resolvableDependencies)
|
||||
{
|
||||
@@ -1187,7 +1186,7 @@ namespace Spring.Objects.Factory.Support
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < candidateNames.Length; i++)
|
||||
for (int i = 0; i < candidateNames.Count; i++)
|
||||
{
|
||||
string candidateName = candidateNames[i];
|
||||
if (!candidateName.Equals(objectName) && IsAutowireCandidate(candidateName, descriptor))
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Spring.Objects.Factory.Config;
|
||||
|
||||
#endregion
|
||||
@@ -159,7 +161,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// preparation on startup.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
new string[] DependsOn { get; set; }
|
||||
new IList<string> DependsOn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the initializer method.
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#region Imports
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Spring.Objects.Factory;
|
||||
using Spring.Objects.Factory.Config;
|
||||
|
||||
@@ -69,7 +71,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// The names of all objects defined in this registry, or an empty array
|
||||
/// if none defined
|
||||
/// </returns>
|
||||
string [] GetObjectDefinitionNames ();
|
||||
IList<string> GetObjectDefinitionNames ();
|
||||
|
||||
/// <summary>
|
||||
/// Check if this registry contains a object definition with the given name.
|
||||
@@ -126,25 +128,25 @@ namespace Spring.Objects.Factory.Support
|
||||
/// If the object definition is invalid.
|
||||
/// </exception>
|
||||
void RegisterObjectDefinition (string name, IObjectDefinition definition);
|
||||
|
||||
/// <summary>
|
||||
/// Return the aliases for the given object name, if defined.
|
||||
/// </summary>
|
||||
/// <param name="name">the object name to check for aliases
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// Will ask the parent factory if the object cannot be found in this
|
||||
/// factory instance.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
/// <returns>
|
||||
/// The aliases, or an empty array if none.
|
||||
/// </returns>
|
||||
/// <exception cref="Spring.Objects.Factory.NoSuchObjectDefinitionException">
|
||||
/// If there's no such object definition.
|
||||
/// </exception>
|
||||
string [] GetAliases (string name);
|
||||
|
||||
/// <summary>
|
||||
/// Return the aliases for the given object name, if defined.
|
||||
/// </summary>
|
||||
/// <param name="name">the object name to check for aliases
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// Will ask the parent factory if the object cannot be found in this
|
||||
/// factory instance.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
/// <returns>
|
||||
/// The aliases, or an empty array if none.
|
||||
/// </returns>
|
||||
/// <exception cref="Spring.Objects.Factory.NoSuchObjectDefinitionException">
|
||||
/// If there's no such object definition.
|
||||
/// </exception>
|
||||
IList<string> GetAliases (string name);
|
||||
|
||||
/// <summary>
|
||||
/// Given a object name, create an alias. We typically use this method to
|
||||
|
||||
@@ -397,7 +397,7 @@ namespace Spring.Objects.Factory.Support
|
||||
List<string> arrayList = new List<string>();
|
||||
arrayList.AddRange(objectDefinition.DependsOn);
|
||||
arrayList.AddRange(new string[]{ objectName});
|
||||
objectDefinition.DependsOn = arrayList.ToArray();
|
||||
objectDefinition.DependsOn = arrayList;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using Spring.Objects.Factory;
|
||||
|
||||
using Spring.Objects.Factory.Config;
|
||||
using Spring.Objects.Factory.Xml;
|
||||
using Spring.Objects.Support;
|
||||
@@ -96,8 +96,8 @@ namespace Spring.Objects.Factory.Support
|
||||
AssertUtils.ArgumentNotNull(registry, "registry");
|
||||
|
||||
registry.RegisterObjectDefinition(objectDefinition.ObjectName, objectDefinition.ObjectDefinition);
|
||||
string[] aliases = objectDefinition.Aliases;
|
||||
for (int i = 0; i < aliases.Length; ++i)
|
||||
IList<string> aliases = objectDefinition.Aliases;
|
||||
for (int i = 0; i < aliases.Count; ++i)
|
||||
{
|
||||
string alias = aliases[i];
|
||||
registry.RegisterAlias(objectDefinition.ObjectName, alias);
|
||||
|
||||
@@ -498,7 +498,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// <exception cref="Spring.Objects.Factory.NoSuchObjectDefinitionException">
|
||||
/// If there's no such object definition.
|
||||
/// </exception>
|
||||
public string[] GetAliases(string name)
|
||||
public IList<string> GetAliases(string name)
|
||||
{
|
||||
return StringUtils.EmptyStrings;
|
||||
}
|
||||
@@ -551,10 +551,10 @@ namespace Spring.Objects.Factory.Support
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
public string[] GetObjectDefinitionNames()
|
||||
public IList<string> GetObjectDefinitionNames()
|
||||
{
|
||||
List<string> names = new List<string>(objects.Keys);
|
||||
return names.ToArray();
|
||||
return names;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -575,7 +575,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
public string[] GetObjectDefinitionNames(Type type)
|
||||
public IList<string> GetObjectDefinitionNames(Type type)
|
||||
{
|
||||
List<string> matches = new List<string>();
|
||||
foreach (string name in objects.Keys)
|
||||
@@ -586,7 +586,7 @@ namespace Spring.Objects.Factory.Support
|
||||
matches.Add(name);
|
||||
}
|
||||
}
|
||||
return matches.ToArray();
|
||||
return matches;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -612,7 +612,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
public string[] GetObjectNamesForType(Type type)
|
||||
public IList<string> GetObjectNamesForType(Type type)
|
||||
{
|
||||
return GetObjectNamesForType(type, true, true);
|
||||
}
|
||||
@@ -640,7 +640,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
public string[] GetObjectNamesForType<T>()
|
||||
public IList<string> GetObjectNames<T>()
|
||||
{
|
||||
return GetObjectNamesForType(typeof(T));
|
||||
}
|
||||
@@ -674,8 +674,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
/// <seealso cref="Spring.Objects.Factory.IListableObjectFactory.GetObjectNamesForType(Type, bool, bool)"/>
|
||||
public string[] GetObjectNamesForType(
|
||||
Type type, bool includePrototypes, bool includeFactoryObjects)
|
||||
public IList<string> GetObjectNamesForType(Type type, bool includePrototypes, bool includeFactoryObjects)
|
||||
{
|
||||
bool isFactoryType = (type != null && typeof(IFactoryObject).IsAssignableFrom(type));
|
||||
List<string> matches = new List<string>();
|
||||
@@ -701,7 +700,7 @@ namespace Spring.Objects.Factory.Support
|
||||
}
|
||||
}
|
||||
}
|
||||
return matches.ToArray();
|
||||
return matches;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -739,7 +738,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// The names of all objects defined in this factory, or an empty array if none
|
||||
/// are defined.
|
||||
/// </returns>
|
||||
public string[] GetObjectNamesForType<T>(bool includePrototypes, bool includeFactoryObjects)
|
||||
public IList<string> GetObjectNames<T>(bool includePrototypes, bool includeFactoryObjects)
|
||||
{
|
||||
return GetObjectNamesForType(typeof(T), includePrototypes, includeFactoryObjects);
|
||||
}
|
||||
@@ -816,7 +815,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// If the objects could not be created.
|
||||
/// </exception>
|
||||
public IDictionary<string, T> GetObjectsOfType<T>()
|
||||
public IDictionary<string, T> GetObjects<T>()
|
||||
{
|
||||
Dictionary<string, T> collector = new Dictionary<string, T>();
|
||||
DoGetObjectsOfType(typeof(T), true, true, collector);
|
||||
@@ -917,7 +916,7 @@ namespace Spring.Objects.Factory.Support
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// If the objects could not be created.
|
||||
/// </exception>
|
||||
public IDictionary<string, T> GetObjectsOfType<T>(bool includePrototypes, bool includeFactoryObjects)
|
||||
public IDictionary<string, T> GetObjects<T>(bool includePrototypes, bool includeFactoryObjects)
|
||||
{
|
||||
Dictionary<string, T> collector = new Dictionary<string, T>();
|
||||
DoGetObjectsOfType(typeof(T), includeFactoryObjects, includePrototypes, collector);
|
||||
@@ -955,13 +954,13 @@ namespace Spring.Objects.Factory.Support
|
||||
/// </exception>
|
||||
public T GetObject<T>()
|
||||
{
|
||||
string[] objectNamesForType = GetObjectNamesForType(typeof(T));
|
||||
if ((objectNamesForType == null) || (objectNamesForType.Length == 0))
|
||||
IList<string> objectNamesForType = GetObjectNamesForType(typeof(T));
|
||||
if ((objectNamesForType == null) || (objectNamesForType.Count == 0))
|
||||
{
|
||||
throw new NoSuchObjectDefinitionException(typeof(T).FullName, "Requested Type not Defined in the Context.");
|
||||
}
|
||||
|
||||
if (objectNamesForType.Length > 1)
|
||||
if (objectNamesForType.Count > 1)
|
||||
{
|
||||
throw new ObjectDefinitionStoreException(string.Format("More than one definition for {0} found in the Context.", typeof(T).FullName));
|
||||
}
|
||||
|
||||
@@ -322,8 +322,8 @@ namespace Spring.Objects.Factory.Xml
|
||||
|
||||
#endregion
|
||||
}
|
||||
string[] aliasesArray = aliases.ToArray();
|
||||
return CreateObjectDefinitionHolder(element, definition, objectName, aliasesArray);
|
||||
|
||||
return CreateObjectDefinitionHolder(element, definition, objectName, aliases);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -334,9 +334,9 @@ namespace Spring.Objects.Factory.Xml
|
||||
/// <remarks>
|
||||
/// This method may be used as a last resort to post-process an object definition before it gets added to the registry.
|
||||
/// </remarks>
|
||||
protected virtual ObjectDefinitionHolder CreateObjectDefinitionHolder(XmlElement element, IConfigurableObjectDefinition definition, string objectName, string[] aliasesArray)
|
||||
protected virtual ObjectDefinitionHolder CreateObjectDefinitionHolder(XmlElement element, IConfigurableObjectDefinition definition, string objectName, IList<string> aliases)
|
||||
{
|
||||
return new ObjectDefinitionHolder(definition, objectName, aliasesArray);
|
||||
return new ObjectDefinitionHolder(definition, objectName, aliases);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -26,13 +26,11 @@ using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
|
||||
using Common.Logging;
|
||||
|
||||
using Spring.Collections;
|
||||
using Spring.Core;
|
||||
using Spring.Core.IO;
|
||||
using Spring.Core.TypeResolution;
|
||||
using Spring.Objects.Factory.Config;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#region Imports
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -41,7 +42,7 @@ namespace Spring.Objects
|
||||
/// An array of the <see cref="Spring.Objects.PropertyValue"/> objects held
|
||||
/// in this object.
|
||||
/// </returns>
|
||||
PropertyValue [] PropertyValues
|
||||
IList<PropertyValue> PropertyValues
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ namespace Spring.Objects
|
||||
/// <see cref="Spring.Objects.PropertyValue"/>s can be added with the various
|
||||
/// overloaded <see cref="Spring.Objects.MutablePropertyValues.Add(PropertyValue)"/>,
|
||||
/// <see cref="Spring.Objects.MutablePropertyValues.Add(string, object)"/>,
|
||||
/// <see cref="Spring.Objects.MutablePropertyValues.AddAll(IDictionary)"/>,
|
||||
/// and <see cref="Spring.Objects.MutablePropertyValues.AddAll(IList)"/>
|
||||
/// <see cref="Spring.Objects.MutablePropertyValues.AddAll(IDictionary{string, object})"/>,
|
||||
/// and <see cref="Spring.Objects.MutablePropertyValues.AddAll(IList{PropertyValue})"/>
|
||||
/// methods.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
@@ -96,7 +96,7 @@ namespace Spring.Objects
|
||||
{
|
||||
if (other != null)
|
||||
{
|
||||
AddAll (other.PropertyValues);
|
||||
AddAll(other.PropertyValues);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace Spring.Objects
|
||||
/// The <see cref="System.Collections.IDictionary"/> with property values
|
||||
/// keyed by property name, which must be a <see cref="System.String"/>.
|
||||
/// </param>
|
||||
public MutablePropertyValues (IDictionary map)
|
||||
public MutablePropertyValues (IDictionary<string, object> map)
|
||||
{
|
||||
AddAll (map);
|
||||
}
|
||||
@@ -120,9 +120,9 @@ namespace Spring.Objects
|
||||
/// <summary>
|
||||
/// Property to retrieve the array of property values.
|
||||
/// </summary>
|
||||
public PropertyValue[] PropertyValues
|
||||
public IList<PropertyValue> PropertyValues
|
||||
{
|
||||
get { return propertyValuesList.ToArray(); }
|
||||
get { return propertyValuesList; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -154,7 +154,7 @@ namespace Spring.Objects
|
||||
{
|
||||
for (int i = 0; i < propertyValuesList.Count; ++i)
|
||||
{
|
||||
PropertyValue currentPv = (PropertyValue) propertyValuesList [i];
|
||||
PropertyValue currentPv = propertyValuesList [i];
|
||||
if (currentPv.Name.Equals (pv.Name))
|
||||
{
|
||||
pv = MergeIfRequired(pv, currentPv);
|
||||
@@ -196,13 +196,13 @@ namespace Spring.Objects
|
||||
/// The map of property values, the keys of which must be
|
||||
/// <see cref="System.String"/>s.
|
||||
/// </param>
|
||||
public void AddAll (IDictionary map)
|
||||
public void AddAll (IDictionary<string, object> map)
|
||||
{
|
||||
if (map != null)
|
||||
{
|
||||
foreach (string key in map.Keys)
|
||||
foreach (KeyValuePair<string, object> pair in map)
|
||||
{
|
||||
Add (new PropertyValue (key, map [key]));
|
||||
Add (new PropertyValue (pair.Key, pair.Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -214,7 +214,7 @@ namespace Spring.Objects
|
||||
/// <param name="values">
|
||||
/// The list of <see cref="Spring.Objects.PropertyValue"/>s to be added.
|
||||
/// </param>
|
||||
public void AddAll (IList values)
|
||||
public void AddAll(IList<PropertyValue> values)
|
||||
{
|
||||
if (values != null)
|
||||
{
|
||||
@@ -357,10 +357,10 @@ namespace Spring.Objects
|
||||
/// </returns>
|
||||
public override string ToString ()
|
||||
{
|
||||
PropertyValue[] pvs = PropertyValues;
|
||||
IList<PropertyValue> pvs = PropertyValues;
|
||||
StringBuilder sb
|
||||
= new StringBuilder (
|
||||
"MutablePropertyValues: length=").Append (pvs.Length).Append ("; ");
|
||||
"MutablePropertyValues: length=").Append (pvs.Count).Append ("; ");
|
||||
sb.Append (StringUtils.ArrayToDelimitedString (pvs, ","));
|
||||
return sb.ToString ();
|
||||
}
|
||||
|
||||
@@ -102,10 +102,7 @@ namespace Spring.Objects
|
||||
: base(string.Empty)
|
||||
{
|
||||
_objectWrapper = objectWrapper;
|
||||
_propertyAccessExceptions
|
||||
= propertyAccessExceptions == null ?
|
||||
EmptyPropertyAccessExceptions :
|
||||
propertyAccessExceptions;
|
||||
_propertyAccessExceptions = propertyAccessExceptions ?? EmptyPropertyAccessExceptions;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Spring.Proxy
|
||||
private string _name;
|
||||
private Type _targetType;
|
||||
private Type _baseType = typeof (object);
|
||||
private Type[] _interfaces;
|
||||
private IList<Type> _interfaces;
|
||||
private bool _proxyTargetAttributes = true;
|
||||
private IList _typeAttributes = new ArrayList();
|
||||
private IDictionary _memberAttributes = new Hashtable();
|
||||
@@ -126,7 +126,7 @@ namespace Spring.Proxy
|
||||
/// The default value of this property is all the interfaces
|
||||
/// implemented or inherited by the target type.
|
||||
/// </remarks>
|
||||
public Type[] Interfaces
|
||||
public IList<Type> Interfaces
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -873,22 +873,22 @@ namespace Spring.Proxy
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Returns an array of <see cref="System.Type"/>s that represent
|
||||
/// the proxiable interfaces.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// An interface is proxiable if it's not marked with the
|
||||
/// <see cref="ProxyIgnoreAttribute"/>.
|
||||
/// </remarks>
|
||||
/// <param name="interfaces">
|
||||
/// The array of interfaces from which
|
||||
/// we want to get the proxiable interfaces.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// An array containing the interface <see cref="System.Type"/>s.
|
||||
/// </returns>
|
||||
protected virtual Type[] GetProxiableInterfaces(Type[] interfaces)
|
||||
/// <summary>
|
||||
/// Returns an array of <see cref="System.Type"/>s that represent
|
||||
/// the proxiable interfaces.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// An interface is proxiable if it's not marked with the
|
||||
/// <see cref="ProxyIgnoreAttribute"/>.
|
||||
/// </remarks>
|
||||
/// <param name="interfaces">
|
||||
/// The array of interfaces from which
|
||||
/// we want to get the proxiable interfaces.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// An array containing the interface <see cref="System.Type"/>s.
|
||||
/// </returns>
|
||||
protected virtual IList<Type> GetProxiableInterfaces(IList<Type> interfaces)
|
||||
{
|
||||
List<Type> proxiableInterfaces = new List<Type>();
|
||||
|
||||
@@ -914,7 +914,7 @@ namespace Spring.Proxy
|
||||
}
|
||||
}
|
||||
|
||||
return proxiableInterfaces.ToArray();
|
||||
return proxiableInterfaces;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Spring.Proxy
|
||||
/// </exception>
|
||||
public override Type BuildProxyType()
|
||||
{
|
||||
if (Interfaces == null || Interfaces.Length == 0)
|
||||
if (Interfaces == null || Interfaces.Count == 0)
|
||||
{
|
||||
throw new ArgumentException(
|
||||
"Composition proxy target must implement at least one interface.");
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -60,7 +61,7 @@ namespace Spring.Proxy
|
||||
/// <summary>
|
||||
/// Gets or sets the list of interfaces proxy should implement.
|
||||
/// </summary>
|
||||
Type[] Interfaces { get; set; }
|
||||
IList<Type> Interfaces { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Should we proxy target attributes?
|
||||
|
||||
@@ -47,14 +47,14 @@ namespace Spring.Util
|
||||
get { return _eventExceptions.Count > 0; }
|
||||
}
|
||||
|
||||
public Delegate[] Sources
|
||||
public IList<Delegate> Sources
|
||||
{
|
||||
get { return new List<Delegate>(_eventExceptions.Keys).ToArray(); }
|
||||
get { return new List<Delegate>(_eventExceptions.Keys); }
|
||||
}
|
||||
|
||||
public Exception[] Exceptions
|
||||
public IList<Exception> Exceptions
|
||||
{
|
||||
get { return new List<Exception>(_eventExceptions.Values).ToArray(); }
|
||||
get { return new List<Exception>(_eventExceptions.Values); }
|
||||
}
|
||||
|
||||
public Exception this[Delegate source]
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Spring.Util
|
||||
{
|
||||
public interface IEventExceptionsCollector
|
||||
{
|
||||
bool HasExceptions { get; }
|
||||
Delegate[] Sources { get;}
|
||||
Exception[] Exceptions { get; }
|
||||
IList<Delegate> Sources { get;}
|
||||
IList<Exception> Exceptions { get; }
|
||||
Exception this[Delegate source] { get; }
|
||||
}
|
||||
}
|
||||
@@ -386,7 +386,7 @@ namespace Spring.Util
|
||||
/// <exception cref="AmbiguousMatchException">
|
||||
/// If more than 1 matching methods are found in the <paramref name="methods"/> list.
|
||||
/// </exception>
|
||||
public static MethodInfo GetMethodByArgumentValues(MethodInfo[] methods, object[] argValues)
|
||||
public static MethodInfo GetMethodByArgumentValues<T>(IEnumerable<T> methods, object[] argValues) where T : MethodBase
|
||||
{
|
||||
return (MethodInfo)GetMethodBaseByArgumentValues("method", methods, argValues);
|
||||
}
|
||||
@@ -401,8 +401,7 @@ namespace Spring.Util
|
||||
/// <exception cref="AmbiguousMatchException">
|
||||
/// If more than 1 matching methods are found in the <paramref name="methods"/> list.
|
||||
/// </exception>
|
||||
private static MethodBase GetMethodBaseByArgumentValues(string methodTypeName, MethodBase[] methods,
|
||||
object[] argValues)
|
||||
private static MethodBase GetMethodBaseByArgumentValues<T>(string methodTypeName, IEnumerable<T> methods, object[] argValues) where T : MethodBase
|
||||
{
|
||||
MethodBase match = null;
|
||||
int matchCount = 0;
|
||||
@@ -490,7 +489,7 @@ namespace Spring.Util
|
||||
/// <exception cref="AmbiguousMatchException">
|
||||
/// If more than 1 matching methods are found in the <paramref name="methods"/> list.
|
||||
/// </exception>
|
||||
public static ConstructorInfo GetConstructorByArgumentValues(ConstructorInfo[] methods, object[] argValues)
|
||||
public static ConstructorInfo GetConstructorByArgumentValues<T>(IList<T> methods, object[] argValues) where T : MethodBase
|
||||
{
|
||||
return (ConstructorInfo)GetMethodBaseByArgumentValues("constructor", methods, argValues);
|
||||
}
|
||||
@@ -540,7 +539,7 @@ namespace Spring.Util
|
||||
/// <exception cref="System.ArgumentNullException">
|
||||
/// If <paramref name="intf"/> is <see langword="null"/>.
|
||||
/// </exception>
|
||||
public static Type[] ToInterfaceArray(Type intf)
|
||||
public static IList<Type> ToInterfaceArray(Type intf)
|
||||
{
|
||||
AssertUtils.ArgumentNotNull(intf, "intf");
|
||||
|
||||
@@ -555,7 +554,7 @@ namespace Spring.Util
|
||||
List<Type> interfaces = new List<Type>(intf.GetInterfaces());
|
||||
interfaces.Add(intf);
|
||||
|
||||
return interfaces.ToArray();
|
||||
return interfaces;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -325,8 +325,8 @@ namespace Spring.Util
|
||||
/// The delimiter to use (probably a ',').
|
||||
/// </param>
|
||||
/// <returns>The delimited string representation.</returns>
|
||||
public static string CollectionToDelimitedString(
|
||||
ICollection c, string delimiter)
|
||||
public static string CollectionToDelimitedString<T>(
|
||||
IEnumerable<T> c, string delimiter)
|
||||
{
|
||||
if (c == null)
|
||||
{
|
||||
@@ -354,8 +354,7 @@ namespace Spring.Util
|
||||
/// The <see cref="System.Collections.ICollection"/> to display.
|
||||
/// </param>
|
||||
/// <returns>The delimited string representation.</returns>
|
||||
public static string CollectionToCommaDelimitedString(
|
||||
ICollection collection)
|
||||
public static string CollectionToCommaDelimitedString<T>(IEnumerable<T> collection)
|
||||
{
|
||||
return CollectionToDelimitedString(collection, ",");
|
||||
}
|
||||
@@ -369,7 +368,7 @@ namespace Spring.Util
|
||||
/// <see cref="System.Object.ToString"/> will be called on each
|
||||
/// element).
|
||||
/// </param>
|
||||
public static string ArrayToCommaDelimitedString(object[] source)
|
||||
public static string ArrayToCommaDelimitedString<T>(IEnumerable<T> source)
|
||||
{
|
||||
return ArrayToDelimitedString(source, ",");
|
||||
}
|
||||
@@ -386,8 +385,7 @@ namespace Spring.Util
|
||||
/// <param name="delimiter">
|
||||
/// The delimiter to use (probably a ',').
|
||||
/// </param>
|
||||
public static string ArrayToDelimitedString(
|
||||
object[] source, string delimiter)
|
||||
public static string ArrayToDelimitedString<T>(IEnumerable<T> source, string delimiter)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using NHibernate.Bytecode;
|
||||
|
||||
@@ -53,8 +54,8 @@ namespace Spring.Data.NHibernate.Bytecode
|
||||
/// <returns>A reference to the created object.</returns>
|
||||
public object CreateInstance(Type type)
|
||||
{
|
||||
string[] namesForType = listableObjectFactory.GetObjectNamesForType(type);
|
||||
return namesForType.Length > 0 ? listableObjectFactory.GetObject(namesForType[0], type) : Activator.CreateInstance(type);
|
||||
IList<string> namesForType = listableObjectFactory.GetObjectNamesForType(type);
|
||||
return namesForType.Count > 0 ? listableObjectFactory.GetObject(namesForType[0], type) : Activator.CreateInstance(type);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -64,8 +65,8 @@ namespace Spring.Data.NHibernate.Bytecode
|
||||
/// <returns>A reference to the created object </returns>
|
||||
public object CreateInstance(Type type, bool nonPublic)
|
||||
{
|
||||
string[] namesForType = listableObjectFactory.GetObjectNamesForType(type);
|
||||
return namesForType.Length > 0 ? listableObjectFactory.GetObject(namesForType[0], type) : Activator.CreateInstance(type);
|
||||
IList<string> namesForType = listableObjectFactory.GetObjectNamesForType(type);
|
||||
return namesForType.Count > 0 ? listableObjectFactory.GetObject(namesForType[0], type) : Activator.CreateInstance(type);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using NHibernate.Properties;
|
||||
|
||||
@@ -57,8 +58,8 @@ namespace Spring.Data.NHibernate.Bytecode
|
||||
/// <returns>The new instance.</returns>
|
||||
public override object CreateInstance()
|
||||
{
|
||||
string[] namesForType = listableObjectFactory.GetObjectNamesForType(mappedType);
|
||||
if (namesForType.Length > 0)
|
||||
IList<string> namesForType = listableObjectFactory.GetObjectNamesForType(mappedType);
|
||||
if (namesForType.Count > 0)
|
||||
{
|
||||
return listableObjectFactory.GetObject(namesForType[0], mappedType);
|
||||
}
|
||||
|
||||
@@ -610,7 +610,7 @@ namespace Spring.Data.NHibernate
|
||||
// Register cache strategies for mapped entities.
|
||||
foreach (string className in this.entityCacheStrategies.Keys)
|
||||
{
|
||||
String[] strategyAndRegion = StringUtils.CommaDelimitedListToStringArray(this.entityCacheStrategies.GetProperty(className));
|
||||
string[] strategyAndRegion = StringUtils.CommaDelimitedListToStringArray(this.entityCacheStrategies.GetProperty(className));
|
||||
if (strategyAndRegion.Length > 1)
|
||||
{
|
||||
config.SetCacheConcurrencyStrategy(className, strategyAndRegion[0], strategyAndRegion[1]);
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Common.Logging;
|
||||
using NHibernate;
|
||||
using NHibernate.Connection;
|
||||
@@ -695,7 +697,7 @@ namespace Spring.Data.NHibernate
|
||||
{
|
||||
Type hibCommandType = db.CreateCommand().GetType();
|
||||
|
||||
string[] providerNames = ctx.GetObjectNamesForType(typeof(DbProvider), true, false);
|
||||
IList<string> providerNames = ctx.GetObjectNamesForType(typeof(DbProvider), true, false);
|
||||
string hibCommandAQN = hibCommandType.AssemblyQualifiedName;
|
||||
foreach (string providerName in providerNames)
|
||||
{
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Common.Logging;
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
@@ -143,10 +145,10 @@ namespace Spring.Data.Common
|
||||
ctx = new XmlApplicationContext(DBPROVIDER_CONTEXTNAME, true, new string[] { DBPROVIDER_DEFAULT_RESOURCE_NAME });
|
||||
}
|
||||
|
||||
string[] dbProviderNames = ctx.GetObjectNamesForType(typeof(IDbProvider));
|
||||
IList<string> dbProviderNames = ctx.GetObjectNames<IDbProvider>();
|
||||
if (log.IsInfoEnabled)
|
||||
{
|
||||
log.Info(String.Format("{0} DbProviders Available. [{1}]", dbProviderNames.Length, StringUtils.ArrayToCommaDelimitedString(dbProviderNames)));
|
||||
log.Info(String.Format("{0} DbProviders Available. [{1}]", dbProviderNames.Count, StringUtils.CollectionToCommaDelimitedString(dbProviderNames)));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -167,8 +167,7 @@ namespace Spring.Data.Core
|
||||
{
|
||||
throw new ArgumentException("DataReaderWrapper type must implement IDataReaderWrapper. Implemented interfaces on "
|
||||
+ value.GetType().Name + "are [" +
|
||||
StringUtils.ArrayToCommaDelimitedString(
|
||||
ReflectionUtils.ToInterfaceArray(value)) + "]");
|
||||
StringUtils.CollectionToCommaDelimitedString(ReflectionUtils.ToInterfaceArray(value)) + "]");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
using Spring.Aop;
|
||||
@@ -71,7 +72,7 @@ namespace Spring.Transaction.Interceptor
|
||||
{
|
||||
private TransactionInterceptor _transactionInterceptor;
|
||||
private object _target;
|
||||
private Type[] _proxyInterfaces;
|
||||
private IList<Type> _proxyInterfaces;
|
||||
private TruePointcut _pointcut;
|
||||
private object[] _preInterceptors;
|
||||
private object[] _postInterceptors;
|
||||
|
||||
@@ -63,9 +63,9 @@ namespace Spring.Messaging.Nms.Connections
|
||||
/// Gets the exception listeners as an array.
|
||||
/// </summary>
|
||||
/// <value>The exception listeners.</value>
|
||||
public IExceptionListener[] Listeners
|
||||
public IList<IExceptionListener> Listeners
|
||||
{
|
||||
get { return listeners.ToArray(); }
|
||||
get { return listeners; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ namespace Spring.Messaging.Core
|
||||
MessageQueueFactoryObject mqfo = new MessageQueueFactoryObject();
|
||||
mqfo.MessageCreatorDelegate = messageQueueCreatorDelegate;
|
||||
applicationContext.ObjectFactory.RegisterSingleton(messageQueueObjectName, mqfo);
|
||||
IDictionary<string, MessageQueueMetadataCache> caches = applicationContext.GetObjectsOfType<MessageQueueMetadataCache>();
|
||||
IDictionary<string, MessageQueueMetadataCache> caches = applicationContext.GetObjects<MessageQueueMetadataCache>();
|
||||
foreach (KeyValuePair<string, MessageQueueMetadataCache> entry in caches)
|
||||
{
|
||||
entry.Value.Insert(mqfo.Path, new MessageQueueMetadata(mqfo.RemoteQueue, mqfo.RemoteQueueIsTransactional));
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Spring.Messaging.Core
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
IDictionary<string, MessageQueueFactoryObject> messageQueueDictionary = configurableApplicationContext.GetObjectsOfType<MessageQueueFactoryObject>();
|
||||
IDictionary<string, MessageQueueFactoryObject> messageQueueDictionary = configurableApplicationContext.GetObjects<MessageQueueFactoryObject>();
|
||||
lock (itemStore.SyncRoot)
|
||||
{
|
||||
foreach (KeyValuePair<string, MessageQueueFactoryObject> entry in messageQueueDictionary)
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System.Collections;
|
||||
|
||||
using Quartz;
|
||||
|
||||
using Spring.Objects;
|
||||
@@ -68,8 +71,14 @@ namespace Spring.Scheduling.Quartz
|
||||
{
|
||||
ObjectWrapper bw = new ObjectWrapper(this);
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.AddAll(context.Scheduler.Context);
|
||||
pvs.AddAll(context.MergedJobDataMap);
|
||||
foreach (DictionaryEntry entry in context.Scheduler.Context)
|
||||
{
|
||||
pvs.Add(entry.Key.ToString(), entry.Value);
|
||||
}
|
||||
foreach (DictionaryEntry entry in context.MergedJobDataMap)
|
||||
{
|
||||
pvs.Add(entry.Key.ToString(), entry.Value);
|
||||
}
|
||||
bw.SetPropertyValues(pvs, true);
|
||||
}
|
||||
catch (SchedulerException ex)
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Quartz;
|
||||
using Quartz.Impl;
|
||||
@@ -132,8 +133,8 @@ namespace Spring.Scheduling.Quartz
|
||||
if (objectFactory is IListableObjectFactory)
|
||||
{
|
||||
IListableObjectFactory lbf = (IListableObjectFactory) objectFactory;
|
||||
string[] objectNames = lbf.GetObjectNamesForType(typeof(IScheduler));
|
||||
for (int i = 0; i < objectNames.Length; i++)
|
||||
IList<string> objectNames = lbf.GetObjectNamesForType(typeof(IScheduler));
|
||||
for (int i = 0; i < objectNames.Count; i++)
|
||||
{
|
||||
IScheduler schedulerObject = (IScheduler)lbf.GetObject(objectNames[i]);
|
||||
if (schedulerName.Equals(schedulerObject.SchedulerName))
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System.Collections;
|
||||
|
||||
using Quartz;
|
||||
using Quartz.Spi;
|
||||
using Spring.Objects;
|
||||
@@ -76,10 +79,19 @@ namespace Spring.Scheduling.Quartz
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
if (schedulerContext != null)
|
||||
{
|
||||
pvs.AddAll(schedulerContext);
|
||||
foreach (DictionaryEntry entry in schedulerContext)
|
||||
{
|
||||
pvs.Add(entry.Key.ToString(), entry.Value);
|
||||
}
|
||||
}
|
||||
foreach (DictionaryEntry entry in bundle.JobDetail.JobDataMap)
|
||||
{
|
||||
pvs.Add(entry.Key.ToString(), entry.Value);
|
||||
}
|
||||
foreach (DictionaryEntry entry in bundle.Trigger.JobDataMap)
|
||||
{
|
||||
pvs.Add(entry.Key.ToString(), entry.Value);
|
||||
}
|
||||
pvs.AddAll(bundle.JobDetail.JobDataMap);
|
||||
pvs.AddAll(bundle.Trigger.JobDataMap);
|
||||
if (ignoredUnknownProperties != null)
|
||||
{
|
||||
for (int i = 0; i < ignoredUnknownProperties.Length; i++)
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.ServiceModel;
|
||||
@@ -491,12 +492,12 @@ namespace Spring.ServiceModel
|
||||
return attrs;
|
||||
}
|
||||
|
||||
protected override Type[] GetProxiableInterfaces(Type[] interfaces)
|
||||
protected override IList<Type> GetProxiableInterfaces(IList<Type> interfaces)
|
||||
{
|
||||
if (contractInterface == null)
|
||||
{
|
||||
Type[] proxiableInterfaces = base.GetProxiableInterfaces(interfaces);
|
||||
if (proxiableInterfaces.Length > 1)
|
||||
IList<Type> proxiableInterfaces = base.GetProxiableInterfaces(interfaces);
|
||||
if (proxiableInterfaces.Count > 1)
|
||||
{
|
||||
throw new ArgumentException(String.Format(
|
||||
"ServiceExporter cannot export service type '{0}' as a WCF service because it implements multiple interfaces. Specify the contract interface to expose via the ContractInterface property.",
|
||||
@@ -558,7 +559,7 @@ namespace Spring.ServiceModel
|
||||
objectDefinition,
|
||||
null, null);
|
||||
|
||||
if (objectDefinition.PropertyValues.PropertyValues.Length == 0)
|
||||
if (objectDefinition.PropertyValues.PropertyValues.Count == 0)
|
||||
{
|
||||
CustomAttributeBuilder cab = new CustomAttributeBuilder(ci.ConstructorInfo,
|
||||
ci.ArgInstances);
|
||||
|
||||
@@ -487,7 +487,7 @@ namespace Spring.Web.Services
|
||||
/// <returns>The generated proxy class.</returns>
|
||||
public override Type BuildProxyType()
|
||||
{
|
||||
if (Interfaces == null || Interfaces.Length == 0)
|
||||
if (Interfaces == null || Interfaces.Count == 0)
|
||||
{
|
||||
throw new ArgumentException(
|
||||
"Web service client proxy must implement at least one interface.");
|
||||
|
||||
@@ -24,15 +24,14 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
|
||||
using NVelocity.Runtime;
|
||||
using NVelocity.Runtime.Resource.Loader;
|
||||
|
||||
using Spring.Core.TypeResolution;
|
||||
using Spring.Objects;
|
||||
using Spring.Objects.Factory;
|
||||
using Spring.Objects.Factory.Config;
|
||||
using Spring.Objects.Factory.Support;
|
||||
using Spring.Objects.Factory.Xml;
|
||||
using Spring.Template.Velocity;
|
||||
using Spring.Util;
|
||||
|
||||
#endregion
|
||||
@@ -226,8 +225,9 @@ namespace Spring.Template.Velocity.Config {
|
||||
/// <param name="elements">a list of nv:file elements defining the paths to template files</param>
|
||||
/// <param name="properties">the properties used to initialize the velocity engine</param>
|
||||
private void AppendFileLoaderProperties(XmlNodeList elements, IDictionary<string, object> properties) {
|
||||
IList paths = new List<string>(elements.Count);
|
||||
foreach (XmlElement element in elements) {
|
||||
IList<string> paths = new List<string>(elements.Count);
|
||||
foreach (XmlElement element in elements)
|
||||
{
|
||||
paths.Add(GetAttributeValue(element, VelocityConstants.Path));
|
||||
}
|
||||
properties.Add(RuntimeConstants.RESOURCE_LOADER, VelocityConstants.File);
|
||||
@@ -241,7 +241,7 @@ namespace Spring.Template.Velocity.Config {
|
||||
/// <param name="elements">a list of nv:assembly elements defining the assemblies</param>
|
||||
/// <param name="properties">the properties used to initialize the velocity engine</param>
|
||||
private void AppendAssemblyLoaderProperties(XmlNodeList elements, IDictionary<string, object> properties) {
|
||||
IList assemblies = new List<string>(elements.Count);
|
||||
IList<string> assemblies = new List<string>(elements.Count);
|
||||
foreach (XmlElement element in elements) {
|
||||
assemblies.Add(GetAttributeValue(element, VelocityConstants.Name));
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Spring.Template.Velocity {
|
||||
|
||||
private IDictionary<string, object> velocityProperties = new Dictionary<string, object>();
|
||||
|
||||
private IList resourceLoaderPaths = new ArrayList();
|
||||
private IList<string> resourceLoaderPaths = new List<string>();
|
||||
|
||||
private IResourceLoader resourceLoader = new ConfigurableResourceLoader();
|
||||
|
||||
@@ -141,7 +141,8 @@ namespace Spring.Template.Velocity {
|
||||
/// <see cref="PreferFileSystemAccess"/>
|
||||
/// <see cref="SpringResourceLoader"/>
|
||||
/// <see cref="FileResourceLoader"/>
|
||||
public IList ResourceLoaderPaths {
|
||||
public IList<string> ResourceLoaderPaths
|
||||
{
|
||||
set { resourceLoaderPaths = value; }
|
||||
}
|
||||
|
||||
@@ -287,12 +288,12 @@ namespace Spring.Template.Velocity {
|
||||
/// <see cref="SpringResourceLoader"/>
|
||||
/// <see cref="InitSpringResourceLoader"/>
|
||||
/// <see cref="CreateVelocityEngine"/>
|
||||
protected void InitVelocityResourceLoader(VelocityEngine velocityEngine, ExtendedProperties extendedProperties, IList paths) {
|
||||
protected void InitVelocityResourceLoader(VelocityEngine velocityEngine, ExtendedProperties extendedProperties, IList<string> paths) {
|
||||
|
||||
if (PreferFileSystemAccess) {
|
||||
// Try to load via the file system, fall back to SpringResourceLoader
|
||||
// (for hot detection of template changes, if possible).
|
||||
IList resolvedPaths = new ArrayList();
|
||||
IList<string> resolvedPaths = new List<string>();
|
||||
try {
|
||||
foreach (string path in paths) {
|
||||
IResource resource = ResourceLoader.GetResource(path);
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace Spring.Testing.Microsoft
|
||||
}
|
||||
if (contextKey is string[])
|
||||
{
|
||||
return StringUtils.ArrayToCommaDelimitedString((string[]) contextKey);
|
||||
return StringUtils.CollectionToCommaDelimitedString((string[])contextKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -216,7 +216,7 @@ namespace Spring.Testing.Microsoft
|
||||
{
|
||||
if (logger.IsInfoEnabled)
|
||||
{
|
||||
logger.Info("Loading config for: " + StringUtils.ArrayToCommaDelimitedString(locations));
|
||||
logger.Info("Loading config for: " + StringUtils.CollectionToCommaDelimitedString(locations));
|
||||
}
|
||||
return new XmlApplicationContext(locations);
|
||||
}
|
||||
|
||||
@@ -19,13 +19,12 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
using Spring.Objects.Factory;
|
||||
using Spring.Objects.Factory.Config;
|
||||
using Spring.Objects.Factory.Support;
|
||||
@@ -90,7 +89,7 @@ namespace Spring.Testing.NUnit
|
||||
/// <summary>
|
||||
/// Holds names of the fields that should be used for field injection.
|
||||
/// </summary>
|
||||
protected string[] managedVariableNames;
|
||||
protected IList<string> managedVariableNames;
|
||||
private int loadCount = 0;
|
||||
|
||||
/// <summary>
|
||||
@@ -231,7 +230,7 @@ namespace Spring.Testing.NUnit
|
||||
/// </summary>
|
||||
protected virtual void InitManagedVariableNames()
|
||||
{
|
||||
ArrayList managedVarNames = new ArrayList();
|
||||
List<string> managedVarNames = new List<string>();
|
||||
Type type = GetType();
|
||||
|
||||
do
|
||||
@@ -273,7 +272,7 @@ namespace Spring.Testing.NUnit
|
||||
type = type.BaseType;
|
||||
} while (type != typeof (AbstractDependencyInjectionSpringContextTests));
|
||||
|
||||
this.managedVariableNames = (string[]) managedVarNames.ToArray(typeof (string));
|
||||
this.managedVariableNames = managedVarNames;
|
||||
}
|
||||
|
||||
private static bool IsProtectedInstanceField(FieldInfo field)
|
||||
@@ -286,7 +285,7 @@ namespace Spring.Testing.NUnit
|
||||
/// </summary>
|
||||
protected virtual void InjectProtectedVariables()
|
||||
{
|
||||
for (int i = 0; i < this.managedVariableNames.Length; i++)
|
||||
for (int i = 0; i < this.managedVariableNames.Count; i++)
|
||||
{
|
||||
string fieldName = this.managedVariableNames[i];
|
||||
Object obj = null;
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace Spring.Testing.NUnit
|
||||
}
|
||||
if (contextKey is string[])
|
||||
{
|
||||
return StringUtils.ArrayToCommaDelimitedString((string[]) contextKey);
|
||||
return StringUtils.CollectionToCommaDelimitedString((string[])contextKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -228,7 +228,7 @@ namespace Spring.Testing.NUnit
|
||||
{
|
||||
if (logger.IsInfoEnabled)
|
||||
{
|
||||
logger.Info("Loading config for: " + StringUtils.ArrayToCommaDelimitedString(locations));
|
||||
logger.Info("Loading config for: " + StringUtils.CollectionToCommaDelimitedString(locations));
|
||||
}
|
||||
return new XmlApplicationContext(locations);
|
||||
}
|
||||
|
||||
@@ -21,13 +21,12 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Web;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Configuration;
|
||||
using System.Web.Hosting;
|
||||
using System.Xml;
|
||||
|
||||
using Common.Logging;
|
||||
|
||||
using Spring.Util;
|
||||
|
||||
#endregion
|
||||
@@ -86,11 +85,10 @@ namespace Spring.Context.Support
|
||||
/// Nesting contexts in webapplications is done by explicitly declaring
|
||||
/// spring context sections for each directory.
|
||||
/// </remarks>
|
||||
protected override void CreateChildContexts(IApplicationContext parentContext, object configContext,
|
||||
XmlNode[] childContexts)
|
||||
protected override void CreateChildContexts(IApplicationContext parentContext, object configContext, IList<XmlNode> childContexts)
|
||||
{
|
||||
// disable child contexts in webapps
|
||||
if (childContexts.Length > 0)
|
||||
if (childContexts.Count > 0)
|
||||
{
|
||||
throw ConfigurationUtils.CreateConfigurationException(
|
||||
String.Format("Nested Child Contexts are not allowed in Web Applications. Use Web.config hierarchy instead."), childContexts[0]);
|
||||
@@ -100,9 +98,7 @@ namespace Spring.Context.Support
|
||||
/// <summary>
|
||||
/// Handles web specific details of context instantiation.
|
||||
/// </summary>
|
||||
protected override IApplicationContext InstantiateContext(IApplicationContext parent, object configContext,
|
||||
string contextName, Type contextType,
|
||||
bool caseSensitive, string[] resources)
|
||||
protected override IApplicationContext InstantiateContext(IApplicationContext parent, object configContext, string contextName, Type contextType, bool caseSensitive, IList<string> resources)
|
||||
{
|
||||
// ASP.NET may scavenge it's configuration section cache if memory usage is too high.
|
||||
// Thus a handler may be called more than once for the same context.
|
||||
@@ -124,8 +120,7 @@ namespace Spring.Context.Support
|
||||
if (!vpath.EndsWith("/")) vpath = vpath + "/";
|
||||
using (new HttpContextSwitch(vpath))
|
||||
{
|
||||
return
|
||||
base.InstantiateContext(parent, configContext, contextName, contextType, caseSensitive, resources);
|
||||
return base.InstantiateContext(parent, configContext, contextName, contextType, caseSensitive, resources);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Spring.Objects.Factory.Xml
|
||||
return objectName;
|
||||
}
|
||||
|
||||
protected override ObjectDefinitionHolder CreateObjectDefinitionHolder(XmlElement element, IConfigurableObjectDefinition definition, string objectName, string[] aliasesArray)
|
||||
protected override ObjectDefinitionHolder CreateObjectDefinitionHolder(XmlElement element, IConfigurableObjectDefinition definition, string objectName, IList<string> aliasesArray)
|
||||
{
|
||||
IWebObjectDefinition webDefinition = definition as IWebObjectDefinition;
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
|
||||
@@ -67,7 +68,7 @@ namespace Spring.Web.Support
|
||||
"Implementations of IApplicationContext must also implement IConfigurableApplicationContext");
|
||||
}
|
||||
|
||||
string[] names = appContext.GetObjectDefinitionNames();
|
||||
IList<string> names = appContext.GetObjectDefinitionNames();
|
||||
foreach (string name in names)
|
||||
{
|
||||
RenderObjectDefinition(res.Output, name, appContext.ObjectFactory.GetObjectDefinition(name));
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#region Imports
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using Spring.Aop.Framework;
|
||||
@@ -70,8 +72,8 @@ namespace Spring.Aop.Config
|
||||
|
||||
IAdvised advised = testObject as IAdvised;
|
||||
Assert.IsNotNull(advised);
|
||||
IAdvisor[] advisors = advised.Advisors;
|
||||
Assert.IsTrue(advisors.Length > 0, "Advisors should not be empty");
|
||||
IList<IAdvisor> advisors = advised.Advisors;
|
||||
Assert.IsTrue(advisors.Count > 0, "Advisors should not be empty");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using AopAlliance.Aop;
|
||||
using NUnit.Framework;
|
||||
using Spring.Objects.Factory.Config;
|
||||
@@ -37,7 +38,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
{
|
||||
public ArrayList CheckedAdvisors = new ArrayList();
|
||||
|
||||
public object[] GetAdvicesAndAdvisorsForObject(Type targetType, string targetName)
|
||||
public IList<object> GetAdvicesAndAdvisorsForObject(Type targetType, string targetName)
|
||||
{
|
||||
return base.GetAdvicesAndAdvisorsForObject(targetType, targetName, null);
|
||||
}
|
||||
@@ -87,8 +88,8 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
|
||||
TestAdvisorAutoProxyCreator apc = new TestAdvisorAutoProxyCreator();
|
||||
apc.ObjectFactory = of;
|
||||
object[] advisors = apc.GetAdvicesAndAdvisorsForObject(typeof (object), "dummyTarget");
|
||||
Assert.AreEqual(1, advisors.Length);
|
||||
IList<object> advisors = apc.GetAdvicesAndAdvisorsForObject(typeof (object), "dummyTarget");
|
||||
Assert.AreEqual(1, advisors.Count);
|
||||
Assert.AreEqual( "RegularAdvisor", ((TestAdvisor)advisors[0]).Name );
|
||||
|
||||
Assert.AreEqual(1, apc.CheckedAdvisors.Count);
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Remoting;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Runtime.Remoting.Proxies;
|
||||
@@ -120,13 +121,13 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
this.ObjectFactory = objectFactory;
|
||||
}
|
||||
|
||||
protected override object[] GetAdvicesAndAdvisorsForObject(Type targetType, string targetName, ITargetSource customTargetSource)
|
||||
protected override IList<object> GetAdvicesAndAdvisorsForObject(Type targetType, string targetName, ITargetSource customTargetSource)
|
||||
{
|
||||
if (typeof(IFactoryObject).IsAssignableFrom(targetType))
|
||||
{
|
||||
return DO_NOT_PROXY;
|
||||
}
|
||||
return new object[] { NopInterceptor };
|
||||
return new List<object> { NopInterceptor };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
using Common.Logging;
|
||||
@@ -93,10 +94,10 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
_logger.Trace("Created instance");
|
||||
}
|
||||
|
||||
protected override object[] GetAdvicesAndAdvisorsForObject(Type targetType, string targetName, ITargetSource customTargetSource)
|
||||
protected override IList<object> GetAdvicesAndAdvisorsForObject(Type targetType, string targetName, ITargetSource customTargetSource)
|
||||
{
|
||||
_logger.Trace("GetAdvicesAndAdvisorsForObject begin");
|
||||
object[] advices = base.GetAdvicesAndAdvisorsForObject(targetType, targetName, customTargetSource);
|
||||
IList<object> advices = base.GetAdvicesAndAdvisorsForObject(targetType, targetName, customTargetSource);
|
||||
_logger.Trace("GetAdvicesAndAdvisorsForObject end");
|
||||
return advices;
|
||||
}
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AopAlliance.Aop;
|
||||
using NUnit.Framework;
|
||||
using Spring.Objects.Factory.Config;
|
||||
@@ -34,7 +35,7 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
{
|
||||
public class TestAdvisorAutoProxyCreator : InfrastructureAdvisorAutoProxyCreator
|
||||
{
|
||||
public object[] GetAdvicesAndAdvisorsForObject(Type targetType, string targetName)
|
||||
public IList<object> GetAdvicesAndAdvisorsForObject(Type targetType, string targetName)
|
||||
{
|
||||
return base.GetAdvicesAndAdvisorsForObject(targetType, targetName, null);
|
||||
}
|
||||
@@ -78,8 +79,8 @@ namespace Spring.Aop.Framework.AutoProxy
|
||||
|
||||
TestAdvisorAutoProxyCreator apc = new TestAdvisorAutoProxyCreator();
|
||||
apc.ObjectFactory = of;
|
||||
object[] advisors = apc.GetAdvicesAndAdvisorsForObject(typeof(object), "dummyTarget");
|
||||
Assert.AreEqual(1, advisors.Length);
|
||||
IList<object> advisors = apc.GetAdvicesAndAdvisorsForObject(typeof(object), "dummyTarget");
|
||||
Assert.AreEqual(1, advisors.Count);
|
||||
Assert.AreEqual("InfrastructureAdvisor", ((TestAdvisor)advisors[0]).Name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1222,7 +1222,7 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
IAdvised a1 = (IAdvised)p;
|
||||
IAdvised a2 = (IAdvised)p2;
|
||||
// Check we can manipulate state of p2
|
||||
Assert.AreEqual(a1.Advisors.Length, a2.Advisors.Length);
|
||||
Assert.AreEqual(a1.Advisors.Count, a2.Advisors.Count);
|
||||
|
||||
// This should work as SerializablePerson is equal
|
||||
Assert.AreEqual(p, p2, "Proxies should be equal, even after one was serialized");
|
||||
@@ -1706,7 +1706,7 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
Assert.AreEqual(2, ni.Count);
|
||||
|
||||
IAdvised advised = (IAdvised)ito;
|
||||
Assert.AreEqual(1, advised.Advisors.Length, "Have 1 advisor");
|
||||
Assert.AreEqual(1, advised.Advisors.Count, "Have 1 advisor");
|
||||
Assert.AreEqual(ni, advised.Advisors[0].Advice);
|
||||
NopInterceptor ni2 = new NopInterceptor();
|
||||
advised.AddAdvice(1, ni2);
|
||||
@@ -1750,7 +1750,7 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
|
||||
// Check it still works: proxy factory state shouldn't have been corrupted
|
||||
Assert.AreEqual(target.Age, proxied.Age);
|
||||
Assert.AreEqual(1, ((IAdvised)proxied).Advisors.Length);
|
||||
Assert.AreEqual(1, ((IAdvised)proxied).Advisors.Count);
|
||||
}
|
||||
|
||||
[Test(Description = "Check that casting to Advised can't get around advice freeze.")]
|
||||
@@ -1778,7 +1778,7 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
|
||||
// Check it still works: proxy factory state shouldn't have been corrupted
|
||||
Assert.AreEqual(target.Age, proxied.Age);
|
||||
Assert.AreEqual(1, advised.Advisors.Length);
|
||||
Assert.AreEqual(1, advised.Advisors.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1805,13 +1805,13 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
}
|
||||
|
||||
// Didn't get removed
|
||||
Assert.AreEqual(1, advised.Advisors.Length);
|
||||
Assert.AreEqual(1, advised.Advisors.Count);
|
||||
pf.IsFrozen = false;
|
||||
// Can now remove it
|
||||
advised.RemoveAdvisor(0);
|
||||
// Check it still works: proxy factory state shouldn't have been corrupted
|
||||
Assert.AreEqual(target.Age, proxied.Age);
|
||||
Assert.AreEqual(0, advised.Advisors.Length);
|
||||
Assert.AreEqual(0, advised.Advisors.Count);
|
||||
}
|
||||
|
||||
[Test(Description = "Check that the string is informative.")]
|
||||
|
||||
@@ -154,11 +154,11 @@ namespace Spring.Aop.Framework
|
||||
IAdvised pc1 = (IAdvised)test1;
|
||||
IAdvised pc2 = (IAdvised)test1_1;
|
||||
Assert.AreEqual(pc1.Advisors, pc2.Advisors);
|
||||
int oldLength = pc1.Advisors.Length;
|
||||
int oldLength = pc1.Advisors.Count;
|
||||
NopInterceptor di = new NopInterceptor();
|
||||
pc1.AddAdvice(1, di);
|
||||
Assert.AreEqual(pc1.Advisors, pc2.Advisors);
|
||||
Assert.AreEqual(oldLength + 1, pc2.Advisors.Length, "Now have one more advisor");
|
||||
Assert.AreEqual(oldLength + 1, pc2.Advisors.Count, "Now have one more advisor");
|
||||
Assert.AreEqual(di.Count, 0);
|
||||
test1.Age = (5);
|
||||
Assert.AreEqual(test1_1.Age, test1.Age);
|
||||
@@ -224,12 +224,12 @@ namespace Spring.Aop.Framework
|
||||
string dummy = to.Name;
|
||||
|
||||
IAdvised config = (IAdvised)to;
|
||||
Assert.AreEqual(1, config.Advisors.Length, "Object should have only one advisors");
|
||||
Assert.AreEqual(1, config.Advisors.Count, "Object should have only one advisors");
|
||||
|
||||
Exception ex = new NotSupportedException("Invoke");
|
||||
// Add evil interceptor to head of list
|
||||
config.AddAdvice(0, new EvilMethodInterceptor(ex));
|
||||
Assert.AreEqual(2, config.Advisors.Length, "The advisor count is wrong after adding an advisor programmatically.");
|
||||
Assert.AreEqual(2, config.Advisors.Count, "The advisor count is wrong after adding an advisor programmatically.");
|
||||
|
||||
try
|
||||
{
|
||||
@@ -266,16 +266,16 @@ namespace Spring.Aop.Framework
|
||||
IIntroductionAdvisor advisor = new DefaultIntroductionAdvisor(ti, typeof(ITimeStamped));
|
||||
|
||||
// add to front of introduction chain
|
||||
int oldCount = config.Introductions.Length;
|
||||
int oldCount = config.Introductions.Count;
|
||||
config.AddIntroduction(0, advisor);
|
||||
Assert.IsTrue(config.Introductions.Length == oldCount + 1);
|
||||
Assert.IsTrue(config.Introductions.Count == oldCount + 1);
|
||||
|
||||
ITimeStamped ts2 = (ITimeStamped)factory.GetObject("test1");
|
||||
Assert.IsTrue(ts2.TimeStamp == new DateTime(time));
|
||||
|
||||
// Can remove
|
||||
config.RemoveIntroduction(advisor);
|
||||
Assert.IsTrue(config.Introductions.Length == oldCount);
|
||||
Assert.IsTrue(config.Introductions.Count == oldCount);
|
||||
|
||||
// Existing reference will still work
|
||||
object o = ts2.TimeStamp;
|
||||
@@ -292,9 +292,9 @@ namespace Spring.Aop.Framework
|
||||
}
|
||||
|
||||
// Now check non-effect of removing interceptor that isn't there
|
||||
oldCount = config.Advisors.Length;
|
||||
oldCount = config.Advisors.Count;
|
||||
config.RemoveAdvice(new DebugAdvice());
|
||||
Assert.IsTrue(config.Advisors.Length == oldCount);
|
||||
Assert.IsTrue(config.Advisors.Count == oldCount);
|
||||
|
||||
ITestObject it = (ITestObject)ts2;
|
||||
DebugAdvice debugInterceptor = new DebugAdvice();
|
||||
@@ -330,16 +330,16 @@ namespace Spring.Aop.Framework
|
||||
IIntroductionAdvisor advisor = new DefaultIntroductionAdvisor(ti, typeof(ITimeStamped));
|
||||
|
||||
// add to front of introduction chain
|
||||
int oldCount = config.Introductions.Length;
|
||||
int oldCount = config.Introductions.Count;
|
||||
config.AddIntroduction(0, advisor);
|
||||
Assert.IsTrue(config.Introductions.Length == oldCount + 1);
|
||||
Assert.IsTrue(config.Introductions.Count == oldCount + 1);
|
||||
|
||||
ITimeStamped ts2 = (ITimeStamped)factory.GetObject("test2");
|
||||
Assert.IsTrue(ts2.TimeStamp == new DateTime(time));
|
||||
|
||||
// Can remove
|
||||
config.RemoveIntroduction(advisor);
|
||||
Assert.IsTrue(config.Introductions.Length == oldCount);
|
||||
Assert.IsTrue(config.Introductions.Count == oldCount);
|
||||
|
||||
// Existing reference will still work
|
||||
object o = ts2.TimeStamp;
|
||||
@@ -358,9 +358,9 @@ namespace Spring.Aop.Framework
|
||||
ITestObject it = (ITestObject)factory.GetObject("test2");
|
||||
config = (IAdvised)it;
|
||||
|
||||
oldCount = config.Advisors.Length;
|
||||
oldCount = config.Advisors.Count;
|
||||
config.RemoveAdvice(new DebugAdvice());
|
||||
Assert.IsTrue(config.Advisors.Length == oldCount);
|
||||
Assert.IsTrue(config.Advisors.Count == oldCount);
|
||||
|
||||
DebugAdvice debugInterceptor = new DebugAdvice();
|
||||
config.AddAdvice(0, debugInterceptor);
|
||||
@@ -462,10 +462,10 @@ namespace Spring.Aop.Framework
|
||||
|
||||
ProxyFactoryObject pfb = (ProxyFactoryObject)factory.GetObject("&validGlobals");
|
||||
pfb.GetObject(); // for creation
|
||||
Assert.AreEqual(2, pfb.Advisors.Length, "Proxy should have 1 global and 1 explicit advisor");
|
||||
Assert.AreEqual(1, pfb.Introductions.Length, "Proxy should have 1 global introduction");
|
||||
Assert.AreEqual(2, pfb.Advisors.Count, "Proxy should have 1 global and 1 explicit advisor");
|
||||
Assert.AreEqual(1, pfb.Introductions.Count, "Proxy should have 1 global introduction");
|
||||
|
||||
agi.GlobalsAdded = ((IAdvised)agi).Introductions.Length;
|
||||
agi.GlobalsAdded = ((IAdvised)agi).Introductions.Count;
|
||||
Assert.IsTrue(agi.GlobalsAdded == 1);
|
||||
|
||||
IApplicationEventListener l = (IApplicationEventListener)factory.GetObject("validGlobals");
|
||||
|
||||
@@ -399,7 +399,7 @@ namespace Spring.Aop.Framework
|
||||
advSup.AddAdvisor(advisor1);
|
||||
advSup.AddAdvisor(advisor1);
|
||||
|
||||
Assert.AreEqual(1, advSup.Advisors.Length);
|
||||
Assert.AreEqual(1, advSup.Advisors.Count);
|
||||
}
|
||||
|
||||
private class AnonymousClassTimeStamped : ITimeStamped
|
||||
@@ -454,7 +454,7 @@ namespace Spring.Aop.Framework
|
||||
// Extend to get new interface
|
||||
TestObjectSubclass raw = new TestObjectSubclass();
|
||||
ProxyFactory factory = new ProxyFactory(raw);
|
||||
Assert.AreEqual(8, factory.Interfaces.Length, "Found correct number of interfaces");
|
||||
Assert.AreEqual(8, factory.Interfaces.Count, "Found correct number of interfaces");
|
||||
//System.out.println("Proxied interfaces are " + StringUtils.arrayToDelimitedString(factory.getProxiedInterfaces(), ","));
|
||||
ITestObject tb = (ITestObject)factory.GetProxy();
|
||||
Assert.IsTrue(tb is IOther, "Picked up secondary interface");
|
||||
@@ -465,14 +465,14 @@ namespace Spring.Aop.Framework
|
||||
DateTime t = new DateTime(2004, 8, 1);
|
||||
TimestampIntroductionInterceptor ti = new TimestampIntroductionInterceptor(t);
|
||||
|
||||
Console.WriteLine(StringUtils.ArrayToDelimitedString(factory.Interfaces, "/"));
|
||||
Console.WriteLine(StringUtils.CollectionToDelimitedString(factory.Interfaces, "/"));
|
||||
|
||||
//factory.addAdvisor(0, new DefaultIntroductionAdvisor(ti, typeof(ITimeStamped)));
|
||||
factory.AddIntroduction(
|
||||
new DefaultIntroductionAdvisor(ti, typeof(ITimeStamped))
|
||||
);
|
||||
|
||||
Console.WriteLine(StringUtils.ArrayToDelimitedString(factory.Interfaces, "/"));
|
||||
Console.WriteLine(StringUtils.CollectionToDelimitedString(factory.Interfaces, "/"));
|
||||
|
||||
ITimeStamped ts = (ITimeStamped)factory.GetProxy();
|
||||
Assert.IsTrue(ts.TimeStamp == t);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
using Common.Logging;
|
||||
using Common.Logging.Simple;
|
||||
|
||||
@@ -44,9 +44,9 @@ namespace Spring.Aspects.Exceptions
|
||||
System.Diagnostics.Trace.Listeners.Remove(listener);
|
||||
}
|
||||
|
||||
private IList logMessages = new ArrayList();
|
||||
private IList<string> logMessages = new List<string>();
|
||||
|
||||
public IList LogMessages
|
||||
public IList<string> LogMessages
|
||||
{
|
||||
get { return logMessages; }
|
||||
set { logMessages = value; }
|
||||
|
||||
@@ -119,28 +119,27 @@ namespace Spring.Context.Support
|
||||
return null;
|
||||
}
|
||||
|
||||
public string[] GetObjectNamesForType(Type type)
|
||||
public IList<string> GetObjectNamesForType(Type type)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string[] GetObjectNamesForType<T>()
|
||||
public IList<string> GetObjectNames<T>()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string[] GetObjectNamesForType(
|
||||
Type type, bool includePrototypes, bool includeFactoryObjects)
|
||||
public IList<string> GetObjectNamesForType(Type type, bool includePrototypes, bool includeFactoryObjects)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string[] GetObjectNamesForType<T>(bool includePrototypes, bool includeFactoryObjects)
|
||||
public IList<string> GetObjectNames<T>(bool includePrototypes, bool includeFactoryObjects)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string[] IListableObjectFactory.GetObjectDefinitionNames()
|
||||
IList<string> IListableObjectFactory.GetObjectDefinitionNames()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -150,7 +149,7 @@ namespace Spring.Context.Support
|
||||
return null;
|
||||
}
|
||||
|
||||
public IDictionary<string, T> GetObjectsOfType<T>()
|
||||
public IDictionary<string, T> GetObjects<T>()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -160,7 +159,7 @@ namespace Spring.Context.Support
|
||||
return null;
|
||||
}
|
||||
|
||||
public IDictionary<string, T> GetObjectsOfType<T>(bool includePrototypes, bool includeFactoryObjects)
|
||||
public IDictionary<string, T> GetObjects<T>(bool includePrototypes, bool includeFactoryObjects)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -199,7 +198,7 @@ namespace Spring.Context.Support
|
||||
return false;
|
||||
}
|
||||
|
||||
public string[] GetAliases(string name)
|
||||
public IList<string> GetAliases(string name)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
using NUnit.Framework;
|
||||
@@ -75,9 +76,9 @@ namespace Spring.Core.TypeResolution
|
||||
{
|
||||
Type[] expected = new Type[] { typeof(IFoo) };
|
||||
string[] input = new string[] { typeof(IFoo).AssemblyQualifiedName };
|
||||
Type[] actual = TypeResolutionUtils.ResolveInterfaceArray(input);
|
||||
IList<Type> actual = TypeResolutionUtils.ResolveInterfaceArray(input);
|
||||
Assert.IsNotNull(actual);
|
||||
Assert.AreEqual(expected.Length, actual.Length);
|
||||
Assert.AreEqual(expected.Length, actual.Count);
|
||||
Assert.AreEqual(expected[0], actual[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
@@ -62,10 +63,10 @@ namespace Spring.Objects.Factory {
|
||||
|
||||
protected internal void AssertCount (int count)
|
||||
{
|
||||
string [] defnames = ListableObjectFactory.GetObjectDefinitionNames ();
|
||||
IList<string> defnames = ListableObjectFactory.GetObjectDefinitionNames ();
|
||||
Assert.IsTrue (
|
||||
defnames.Length == count,
|
||||
string.Format ("We should have {0} objects, not {1}.", count, defnames.Length));
|
||||
defnames.Count == count,
|
||||
string.Format ("We should have {0} objects, not {1}.", count, defnames.Count));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -76,19 +77,19 @@ namespace Spring.Objects.Factory {
|
||||
|
||||
public virtual void AssertTestObjectCount (int count)
|
||||
{
|
||||
string [] defnames =
|
||||
IList<string> defnames =
|
||||
ListableObjectFactory.GetObjectNamesForType (typeof (TestObject));
|
||||
Assert.IsTrue (
|
||||
defnames.Length == count,
|
||||
string.Format ("We should have {0} objects for class {1}, not {2}.", count, typeof (TestObject).FullName, defnames.Length));
|
||||
defnames.Count == count,
|
||||
string.Format ("We should have {0} objects for class {1}, not {2}.", count, typeof (TestObject).FullName, defnames.Count));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public virtual void GetDefinitionsForNoSuchClass ()
|
||||
{
|
||||
string[] defnames =
|
||||
IList<string> defnames =
|
||||
ListableObjectFactory.GetObjectNamesForType (typeof (string));
|
||||
Assert.IsTrue (defnames.Length == 0, "No string definitions");
|
||||
Assert.IsTrue (defnames.Count == 0, "No string definitions");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -101,7 +102,7 @@ namespace Spring.Objects.Factory {
|
||||
{
|
||||
int count =
|
||||
ListableObjectFactory.GetObjectNamesForType (
|
||||
typeof (IFactoryObject)).Length;
|
||||
typeof (IFactoryObject)).Count;
|
||||
Assert.IsTrue (
|
||||
count == 2,
|
||||
string.Format ("Should have 2 factories, not {0}.", count));
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Spring.Objects.Factory
|
||||
Assert.IsTrue(-1 < ex.Message.IndexOf("already registered"));
|
||||
}
|
||||
|
||||
Assert.AreEqual(1, of.GetAliases("nAmE").Length);
|
||||
Assert.AreEqual(1, of.GetAliases("nAmE").Count);
|
||||
Assert.AreEqual(testObject, of.GetObject("nAmE"));
|
||||
Assert.AreEqual(testObject, of.GetObject("ALIAS"));
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace Spring.Objects.Factory
|
||||
def.FactoryMethodName = "CreateTestObject";
|
||||
DefaultListableObjectFactory lof = new DefaultListableObjectFactory();
|
||||
lof.RegisterObjectDefinition("factoryObject", def);
|
||||
IDictionary<string, TestObject> objs = lof.GetObjectsOfType<TestObject>();
|
||||
IDictionary<string, TestObject> objs = lof.GetObjects<TestObject>();
|
||||
Assert.AreEqual(1, objs.Count);
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace Spring.Objects.Factory
|
||||
DefaultListableObjectFactory lof = new DefaultListableObjectFactory();
|
||||
lof.RegisterObjectDefinition("factoryObject", def);
|
||||
lof.RegisterObjectDefinition("target", new RootObjectDefinition(typeof(TestObjectCreator)));
|
||||
IDictionary<string, TestObject> objs = lof.GetObjectsOfType<TestObject>();
|
||||
IDictionary<string, TestObject> objs = lof.GetObjects<TestObject>();
|
||||
Assert.AreEqual(1, objs.Count);
|
||||
}
|
||||
|
||||
@@ -404,8 +404,7 @@ namespace Spring.Objects.Factory
|
||||
|
||||
#region IInstantiationAwareObjectPostProcessor Members
|
||||
|
||||
public IPropertyValues PostProcessPropertyValues(IPropertyValues pvs, PropertyInfo[] pis, object objectInstance,
|
||||
string objectName)
|
||||
public IPropertyValues PostProcessPropertyValues(IPropertyValues pvs, IList<PropertyInfo> pis, object objectInstance, string objectName)
|
||||
{
|
||||
return pvs;
|
||||
}
|
||||
@@ -455,8 +454,7 @@ namespace Spring.Objects.Factory
|
||||
|
||||
#region IInstantiationAwareObjectPostProcessor Members
|
||||
|
||||
public IPropertyValues PostProcessPropertyValues(IPropertyValues pvs, PropertyInfo[] pis, object objectInstance,
|
||||
string objectName)
|
||||
public IPropertyValues PostProcessPropertyValues(IPropertyValues pvs, IList<PropertyInfo> pis, object objectInstance, string objectName)
|
||||
{
|
||||
return pvs;
|
||||
}
|
||||
@@ -532,7 +530,7 @@ namespace Spring.Objects.Factory
|
||||
{
|
||||
IListableObjectFactory lof = new DefaultListableObjectFactory();
|
||||
Assert.IsTrue(lof.GetObjectDefinitionNames() != null, "No objects defined --> array != null");
|
||||
Assert.IsTrue(lof.GetObjectDefinitionNames().Length == 0, "No objects defined after no arg constructor");
|
||||
Assert.IsTrue(lof.GetObjectDefinitionNames().Count == 0, "No objects defined after no arg constructor");
|
||||
Assert.IsTrue(lof.ObjectDefinitionCount == 0, "No objects defined after no arg constructor");
|
||||
}
|
||||
|
||||
@@ -640,7 +638,7 @@ namespace Spring.Objects.Factory
|
||||
lof.RegisterSingleton("singletonObject", singletonObject);
|
||||
Assert.IsTrue(lof.ContainsObject("singletonObject"));
|
||||
Assert.IsTrue(lof.IsSingleton("singletonObject"));
|
||||
Assert.AreEqual(0, lof.GetAliases("singletonObject").Length);
|
||||
Assert.AreEqual(0, lof.GetAliases("singletonObject").Count);
|
||||
DependenciesObject test = (DependenciesObject)lof.GetObject("test");
|
||||
Assert.AreEqual(singletonObject, lof.GetObject("singletonObject"));
|
||||
Assert.AreEqual(singletonObject, test.Spouse);
|
||||
@@ -1751,8 +1749,8 @@ namespace Spring.Objects.Factory
|
||||
DefaultListableObjectFactory of = new DefaultListableObjectFactory();
|
||||
of.RegisterObjectDefinition("mod", new RootObjectDefinition(typeof(A)));
|
||||
|
||||
string[] names = of.GetObjectNamesForType(typeof (ISerializable), false, false);
|
||||
Assert.IsNotEmpty(names);
|
||||
IList<string> names = of.GetObjectNamesForType(typeof (ISerializable), false, false);
|
||||
Assert.IsNotEmpty((ICollection) names);
|
||||
Assert.AreEqual("&mod", names[0]);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user