Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

StaticListableObjectFactory.GetObject(String, Object) Method

Return an instance (possibly shared or independent) of the given object name.

[Visual Basic]
Public NotOverridable Overloads Sub GetObject( _
   ByVal name As String, _
   ByVal arguments As Object _
) _
    Implements IObjectFactory.GetObject
public object GetObject(
   string name,
   object[] arguments


The name of the object to return.
The arguments to use if creating a prototype using explicit arguments to a static factory method. If there is no factory method and the arguments are not null, then match the argument values by type and call the object's constructor.

Return Value

The instance of the object.




This method allows an object factory to be used as a replacement for the Singleton or Prototype design pattern.

Note that callers should retain references to returned objects. There is no guarantee that this method will be implemented to be efficient. For example, it may be synchronized, or may need to run an RDBMS query.

Will ask the parent factory if the object cannot be found in this factory instance.


Exception Type Condition
NoSuchObjectDefinitionException If there's no such object definition.
ObjectsException If the object could not be created.
ArgumentNullException If the supplied name is a null reference (Nothing in Visual Basic).

See Also

StaticListableObjectFactory Class | Spring.Objects.Factory.Support Namespace | StaticListableObjectFactory.GetObject Overload List