Formatting changes and changes to support .Net 3.5 as it can't handle default method values

This commit is contained in:
Thomas Trageser
2013-11-10 17:40:25 +00:00
parent 4005e9eff6
commit 2605f192d2
2 changed files with 50 additions and 44 deletions

View File

@@ -223,50 +223,51 @@ namespace Spring.Objects.Factory.Config
#endregion
/// <summary>
/// Apply the given properties to the supplied
/// <see cref="Spring.Objects.Factory.Config.IConfigurableListableObjectFactory"/>.
/// </summary>
/// <param name="factory">
/// The <see cref="Spring.Objects.Factory.Config.IConfigurableListableObjectFactory"/>
/// used by the application context.
/// </param>
/// <param name="props">The properties to apply.</param>
/// <exception cref="Spring.Objects.ObjectsException">
/// If an error occured.
/// </exception>
protected override void ProcessProperties(IConfigurableListableObjectFactory factory, NameValueCollection props)
{
PlaceholderResolveHandlerAdapter resolveAdapter = new PlaceholderResolveHandlerAdapter(this, props);
ObjectDefinitionVisitor visitor = new ObjectDefinitionVisitor(resolveAdapter.ParseAndResolveVariables);
/// <summary>
/// Apply the given properties to the supplied
/// <see cref="Spring.Objects.Factory.Config.IConfigurableListableObjectFactory"/>.
/// </summary>
/// <param name="factory">
/// The <see cref="Spring.Objects.Factory.Config.IConfigurableListableObjectFactory"/>
/// used by the application context.
/// </param>
/// <param name="props">The properties to apply.</param>
/// <exception cref="Spring.Objects.ObjectsException">
/// If an error occured.
/// </exception>
protected override void ProcessProperties(IConfigurableListableObjectFactory factory, NameValueCollection props)
{
PlaceholderResolveHandlerAdapter resolveAdapter = new PlaceholderResolveHandlerAdapter(this, props);
ObjectDefinitionVisitor visitor = new ObjectDefinitionVisitor(resolveAdapter.ParseAndResolveVariables);
IList<string> objectDefinitionNames = factory.GetObjectDefinitionNames(includeAncestors);
for (int i = 0; i < objectDefinitionNames.Count; ++i)
{
string name = objectDefinitionNames[i];
IObjectDefinition definition = factory.GetObjectDefinition(name, includeAncestors);
IList<string> objectDefinitionNames = factory.GetObjectDefinitionNames(includeAncestors);
for (int i = 0; i < objectDefinitionNames.Count; ++i)
{
string name = objectDefinitionNames[i];
IObjectDefinition definition = factory.GetObjectDefinition(name, includeAncestors);
if (definition == null)
{
logger.ErrorFormat("'{0}' can't be found in factorys' '{1}' object definition (includeAncestor {2})", name, factory, includeAncestors);
continue;
}
if (definition == null)
{
logger.ErrorFormat("'{0}' can't be found in factorys' '{1}' object definition (includeAncestor {2})",
name, factory, includeAncestors);
continue;
}
try
{
visitor.VisitObjectDefinition(definition);
}
catch (ObjectDefinitionStoreException ex)
{
throw new ObjectDefinitionStoreException(
definition.ResourceDescription, name, ex.Message);
}
}
try
{
visitor.VisitObjectDefinition(definition);
}
catch (ObjectDefinitionStoreException ex)
{
throw new ObjectDefinitionStoreException(
definition.ResourceDescription, name, ex.Message);
}
}
factory.AddEmbeddedValueResolver(resolveAdapter);
}
factory.AddEmbeddedValueResolver(resolveAdapter);
}
/// <summary>
/// <summary>
/// Parse values recursively to be able to resolve cross-references between
/// placeholder values.
/// </summary>

View File

@@ -181,7 +181,7 @@ namespace Spring.Objects.Factory.Support
/// <remarks>
/// <p>
/// Called by autowiring. If a subclass cannot obtain information about object
/// -pnames by <see cref="System.Type"/>, a corresponding exception should be thrown.
/// names by <see cref="System.Type"/>, a corresponding exception should be thrown.
/// </p>
/// </remarks>
/// <param name="requiredType">
@@ -239,9 +239,9 @@ namespace Spring.Objects.Factory.Support
if (log.IsDebugEnabled)
{
log.Debug(string.Format(
CultureInfo.InvariantCulture,
"Found depending object '{0}' for object '{1}'.",
name, objectName));
CultureInfo.InvariantCulture,
"Found depending object '{0}' for object '{1}'.",
name, objectName));
}
#endregion
@@ -275,7 +275,12 @@ namespace Spring.Objects.Factory.Support
return (objectType != null && type.IsAssignableFrom(objectType));
}
private bool IsObjectDefinitionTypeMatch(string name, Type checkedType, bool includeAncestor = false)
private bool IsObjectDefinitionTypeMatch(string name, Type checkedType)
{
return IsObjectDefinitionTypeMatch(name, checkedType, false);
}
private bool IsObjectDefinitionTypeMatch(string name, Type checkedType, bool includeAncestor)
{
if (checkedType == null)
{