Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Config
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18183/Spring/Spring.Core/Objects/Factory/Config
Modified Files:
AbstractFactoryObject.cs AutoWiringMode.cs
CustomConverterConfigurer.cs IObjectPostProcessor.cs
MethodInvokingFactoryObject.cs
ObjectFactoryCreatingFactoryObject.cs SetFactoryObject.cs
Log Message:
Added centralised Type resolution mechanism, runtime type converter, Xml Config handler, multiple documentation updates.
Index: ObjectFactoryCreatingFactoryObject.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Config/ObjectFactoryCreatingFactoryObject.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ObjectFactoryCreatingFactoryObject.cs 23 Jul 2004 10:17:15 -0000 1.1
--- ObjectFactoryCreatingFactoryObject.cs 26 Jul 2004 07:47:56 -0000 1.2
***************
*** 21,35 ****
/// <summary>
/// IFactoryObject which returns a value which is an IGenericObjectFactory that returns
! /// a object from an IObjectFactory.
/// </summary>
/// <remarks>
/// As such, this may be used to avoid having a client object directly
! /// calling GetObject() on the IObjectFactory to get a prototype object out
! /// of the IObjectFactory, a violation of inversion of control. Instead, with the use
! /// of this class, the client object can be fed an IObjectFactory as a property which
! /// directly returns only the one target (usually prototype) object.
! ///
! /// A Sample config in an XML IObjectFactory might look as follows:
! ///
/// <objects>
/// <!-- Prototype object since we have state -->
--- 21,42 ----
/// <summary>
/// IFactoryObject which returns a value which is an IGenericObjectFactory that returns
! /// a object from a <see cref="Spring.Objects.Factory.IObjectFactory"/>.
/// </summary>
/// <remarks>
+ /// <p>
/// As such, this may be used to avoid having a client object directly
! /// calling GetObject() on the
! /// <see cref="Spring.Objects.Factory.IObjectFactory"/> to get a prototype
! /// object out of the <see cref="Spring.Objects.Factory.IObjectFactory"/>,
! /// a violation of inversion of control. Instead, with the use of this
! /// class, the client object can be fed an
! /// <see cref="Spring.Objects.Factory.IObjectFactory"/> as a property
! /// that directly returns only the one target (usually prototype) object.
! /// </p>
! /// <p>
! /// A sample config in an XML <see cref="Spring.Objects.Factory.IObjectFactory"/>
! /// might look as follows:
! /// </p>
! /// <p>
/// <objects>
/// <!-- Prototype object since we have state -->
***************
*** 45,52 ****
/// </object>
/// </objects>
/// </remarks>
/// <author>Colin Sampaleanu</author>
! /// <author>Simon White (.NET)</author>
! public class ObjectFactoryCreatingFactoryObject : AbstractFactoryObject, IObjectFactoryAware
{
private string _targetObjectName;
--- 52,62 ----
/// </object>
/// </objects>
+ /// </p>
/// </remarks>
/// <author>Colin Sampaleanu</author>
! /// <author>Simon White (.NET)</author>
! /// <version>$Id$</version>
! public class ObjectFactoryCreatingFactoryObject
! : AbstractFactoryObject, IObjectFactoryAware
{
private string _targetObjectName;
***************
*** 54,57 ****
--- 64,71 ----
#region Properties
+ /// <summary>
+ /// Sets the name of the target object. The target has to be a
+ /// prototype object.
+ /// </summary>
public string TargetObjectName
{
***************
*** 62,65 ****
--- 76,97 ----
}
+ /// <summary>
+ /// Callback that supplies the owning factory to an object instance.
+ /// </summary>
+ /// <value>
+ /// Owning <see cref="Spring.Objects.Factory.IObjectFactory"/>
+ /// (may not be null). The object can immediately call methods on the factory.
+ /// </value>
+ /// <remarks>
+ /// <p>
+ /// Invoked after population of normal object properties but before an init
+ /// callback like <see cref="Spring.Objects.Factory.IInitializingObject"/>'s
+ /// <see cref="Spring.Objects.Factory.IInitializingObject.AfterPropertiesSet"/>
+ /// method or a custom init-method.
+ /// </p>
+ /// </remarks>
+ /// <exception cref="Spring.Objects.ObjectsException">
+ /// In case of initialization errors.
+ /// </exception>
public IObjectFactory ObjectFactory
{
***************
*** 70,78 ****
}
public override Type ObjectType
{
get
{
! return typeof(IObjectFactory);
}
}
--- 102,113 ----
}
+ /// <summary>
+ /// The type of object created by this factory.
+ /// </summary>
public override Type ObjectType
{
get
{
! return typeof (IObjectFactory);
}
}
***************
*** 82,89 ****
/// Returns an instance of the object factory.
/// </summary>
! /// <returns>the object factory</returns>
! protected override object CreateInstance()
{
! return new GenericObjectFactory(this) ;
}
--- 117,124 ----
/// Returns an instance of the object factory.
/// </summary>
! /// <returns>The object factory.</returns>
! protected override object CreateInstance ()
{
! return new GenericObjectFactory (this) ;
}
***************
*** 99,104 ****
/// Constructs a new GenericObjectFactory.
/// </summary>
! /// <param name="enclosing">the enclosing ObjectFactoryCreatingFactoryObject</param>
! public GenericObjectFactory(ObjectFactoryCreatingFactoryObject enclosing)
{
this._enclosing = enclosing;
--- 134,143 ----
/// Constructs a new GenericObjectFactory.
/// </summary>
! /// <param name="enclosing">
! /// The enclosing
! /// <see cref="Spring.Objects.Factory.Config.ObjectFactoryCreatingFactoryObject"/>.
! /// </param>
! public GenericObjectFactory (
! ObjectFactoryCreatingFactoryObject enclosing)
{
this._enclosing = enclosing;
***************
*** 108,115 ****
/// Returns the object created by the enclosed object factory.
/// </summary>
! /// <returns>the created object</returns>
! public object GetObject()
{
! return _enclosing._objectFactory.GetObject(_enclosing._targetObjectName);
}
}
--- 147,154 ----
/// Returns the object created by the enclosed object factory.
/// </summary>
! /// <returns>The created object.</returns>
! public object GetObject ()
{
! return _enclosing._objectFactory.GetObject (_enclosing._targetObjectName);
}
}
Index: CustomConverterConfigurer.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Config/CustomConverterConfigurer.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CustomConverterConfigurer.cs 16 Jul 2004 14:06:17 -0000 1.1
--- CustomConverterConfigurer.cs 26 Jul 2004 07:47:56 -0000 1.2
***************
*** 31,35 ****
/// Configuration example, assuming XML object definitions and inner
/// objects for <see cref="System.ComponentModel.TypeConverter"/> instances:
! ///
/// <object id="customConverterConfigurer" class="Spring.Objects.Factory.Config.CustomConverterConfigurer, Spring.Core">
/// <property name="CustomConverters">
--- 31,35 ----
/// Configuration example, assuming XML object definitions and inner
/// objects for <see cref="System.ComponentModel.TypeConverter"/> instances:
! /// <code>
/// <object id="customConverterConfigurer" class="Spring.Objects.Factory.Config.CustomConverterConfigurer, Spring.Core">
/// <property name="CustomConverters">
***************
*** 46,49 ****
--- 46,50 ----
/// </property>
/// </object>
+ /// </code>
/// </remarks>
/// <author>Juergen Hoeller</author>
***************
*** 121,125 ****
{
string typeName = (string) key;
! requiredType = ObjectUtils.LocateType(typeName);
if (requiredType == null)
--- 122,126 ----
{
string typeName = (string) key;
! requiredType = ObjectUtils.ResolveType (typeName);
if (requiredType == null)
Index: MethodInvokingFactoryObject.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Config/MethodInvokingFactoryObject.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MethodInvokingFactoryObject.cs 23 Jul 2004 10:17:15 -0000 1.1
--- MethodInvokingFactoryObject.cs 26 Jul 2004 07:47:56 -0000 1.2
***************
*** 74,80 ****
}
! /// <summary>
! ///
! /// </summary>
public Type ObjectType
{
--- 74,82 ----
}
! /// <summary>
! /// Return the type of object that this
! /// <see cref="Spring.Objects.Factory.IFactoryObject"/> creates, or null
! /// if not known in advance.
! /// </summary>
public Type ObjectType
{
***************
*** 89,93 ****
}
#endregion
-
#region IFactoryObject Methods
--- 91,94 ----
Index: AbstractFactoryObject.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Config/AbstractFactoryObject.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AbstractFactoryObject.cs 16 Jul 2004 14:06:17 -0000 1.1
--- AbstractFactoryObject.cs 26 Jul 2004 07:47:56 -0000 1.2
***************
*** 32,36 ****
/// <author>Juergen Hoeller</author>
/// <author>Keith Donald</author>
! /// <author>Simon White (.NET)</author>
public abstract class AbstractFactoryObject : IFactoryObject, IInitializingObject
{
--- 32,37 ----
/// <author>Juergen Hoeller</author>
/// <author>Keith Donald</author>
! /// <author>Simon White (.NET)</author>
! /// <version>$Id$</version>
public abstract class AbstractFactoryObject : IFactoryObject, IInitializingObject
{
Index: IObjectPostProcessor.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Config/IObjectPostProcessor.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** IObjectPostProcessor.cs 6 Jul 2004 12:54:27 -0000 1.2
--- IObjectPostProcessor.cs 26 Jul 2004 07:47:56 -0000 1.3
***************
*** 27,41 ****
/// Allows for custom modification of new object instances, e.g.
/// checking for marker interfaces or wrapping them with proxies.
/// <p>
! /// Application contexts can auto-detect BeanPostProcessor objects in their
/// object definitions and apply them before any other objects get created.
/// Plain object factories allow for programmatic registration of post-processors.
/// </p>
/// <p>
! /// Typically, post-processors that populate beans via marker interfaces
/// or the like will implement PostProcessBeforeInitialization, and post-processors
/// that wrap objects with proxies will normally implement PostProcessAfterInitialization.
/// </p>
! /// </summary>
/// <author>Juergen Hoeller</author>
/// <author>Aleksandar Seovic (.Net)</author>
--- 27,43 ----
/// Allows for custom modification of new object instances, e.g.
/// checking for marker interfaces or wrapping them with proxies.
+ /// </summary>
+ /// <remarks>
/// <p>
! /// Application contexts can auto-detect IObjectPostProcessor objects in their
/// object definitions and apply them before any other objects get created.
/// Plain object factories allow for programmatic registration of post-processors.
/// </p>
/// <p>
! /// Typically, post-processors that populate objects via marker interfaces
/// or the like will implement PostProcessBeforeInitialization, and post-processors
/// that wrap objects with proxies will normally implement PostProcessAfterInitialization.
/// </p>
! /// </remarks>
/// <author>Juergen Hoeller</author>
/// <author>Aleksandar Seovic (.Net)</author>
***************
*** 43,53 ****
public interface IObjectPostProcessor
{
-
/// <summary>
/// Apply this <see cref="Spring.Objects.Factory.Config.IObjectPostProcessor"/>
/// to the given new object instance <i>before</i> any object initialization callbacks.
- /// The object will already be populated with property values.
- /// The returned object instance may be a wrapper around the original.
/// </summary>
/// <param name="obj">
/// The new object instance.
--- 45,58 ----
public interface IObjectPostProcessor
{
/// <summary>
/// Apply this <see cref="Spring.Objects.Factory.Config.IObjectPostProcessor"/>
/// to the given new object instance <i>before</i> any object initialization callbacks.
/// </summary>
+ /// <remarks>
+ /// <p>
+ /// The object will already be populated with property values.
+ /// The returned object instance may be a wrapper around the original.
+ /// </p>
+ /// </remarks>
/// <param name="obj">
/// The new object instance.
***************
*** 66,73 ****
/// <summary>
/// Apply this <see cref="Spring.Objects.Factory.Config.IObjectPostProcessor"/> to the
! /// given new object instance <i>after</i> any object initialization callbacks. The
! /// object will already be populated with property values. The returned object
! /// instance may be a wrapper around the original.
! /// </summary>
/// <param name="obj">
/// The new object instance.
--- 71,82 ----
/// <summary>
/// Apply this <see cref="Spring.Objects.Factory.Config.IObjectPostProcessor"/> to the
! /// given new object instance <i>after</i> any object initialization callbacks.
! /// </summary>
! /// <remarks>
! /// <p>
! /// The object will already be populated with property values. The returned object
! /// instance may be a wrapper around the original.
! /// </p>
! /// </remarks>
/// <param name="obj">
/// The new object instance.
Index: SetFactoryObject.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Config/SetFactoryObject.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SetFactoryObject.cs 16 Jul 2004 14:06:17 -0000 1.1
--- SetFactoryObject.cs 26 Jul 2004 07:47:56 -0000 1.2
***************
*** 23,27 ****
/// <summary>
/// Simple factory for shared Set instances. Allows for central setup
! /// of Sets via the "set" element in XML bean definitions.
/// </summary>
/// <author>Juergen Hoeller</author>
--- 23,27 ----
/// <summary>
/// Simple factory for shared Set instances. Allows for central setup
! /// of Sets via the "set" element in XML object definitions.
/// </summary>
/// <author>Juergen Hoeller</author>
Index: AutoWiringMode.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Config/AutoWiringMode.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AutoWiringMode.cs 13 Jul 2004 07:47:45 -0000 1.2
--- AutoWiringMode.cs 26 Jul 2004 07:47:56 -0000 1.3
***************
*** 34,38 ****
public enum AutoWiringMode
{
-
/// <summary>
/// Do not autowire.
--- 34,37 ----
***************
*** 57,61 ****
/// <summary>
/// The autowiring strategy is to be determined by introspection
! /// of the object&s <see cref="System.Type"/>.
/// </summary>
AutoDetect = 4
--- 56,60 ----
/// <summary>
/// The autowiring strategy is to be determined by introspection
! /// of the object's <see cref="System.Type"/>.
/// </summary>
AutoDetect = 4
|