Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

PropertyPathFactoryObject Class

IFactoryObject implementation that evaluates a property path on a given target object.

For a list of all members of this type, see PropertyPathFactoryObject Members .

System.Object
   PropertyPathFactoryObject

[Visual Basic]
<Serializable> _
Public Class PropertyPathFactoryObject
    Implements IFactoryObject, IObjectNameAware, IObjectFactoryAware
[C#]
[Serializable]
public class PropertyPathFactoryObject : IFactoryObject, IObjectNameAware, IObjectFactoryAware

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

The target object can be specified directly or via an object name (see example below).

Please note that the PropertyPathFactoryObject is an IFactoryObject implementation, and as such has to comply with the contract of the IFactoryObject interface; more specifically, this means that the end result of the property lookup path evaluation cannot be (IFactoryObject implementations are not permitted to return ). If the resut of a property lookup path evaluates to , an exception will be thrown.

Example

  <!-- this is the target object -->
  <object id="foo" type="Whatever.MyClass, MyAssembly" singleton="false">
    <!-- a System.String typed property -->
    <property name="name" value="Chinua Achebe" />
  </object>
  <!--
              will result in "Chinua Achebe", which is the value of the 'name' property of the 'foo' object
          -->
  <object id="consumer" type="Spring.Objects.Factory.Config.PropertyPathFactoryObject, Spring.Core">
    <property name="targetObject" ref="foo" />
    <property name="propertyPath" value="name" />
  </object>
  <!--
              will result in "Chinua Achebe", which is the value of the 'name' property of the 'foo' object
          -->
  <object id="foo.name" type="Spring.Objects.Factory.Config.PropertyPathFactoryObject, Spring.Core" />
  <!--
              will result in "Chinua Achebe", which is the value of the 'name' property of the 'foo' object
          -->
  <object id="consumer" type="Spring.Objects.Factory.Config.PropertyPathFactoryObject, Spring.Core">
    <property name="targetObjectName" value="foo" />
    <property name="propertyPath" value="name" />
  </object>
  <!--
              will result in (the int value) '13', which is the value of the length property of the 'name'
              property of the 'foo' object.
              
              in this case, the first 'part' of the id is taken to be the name of the target object ('foo');
              the remainder of the name is taken to be the property lookup path
          -->
  <object id="foo.name.length" type="Spring.Objects.Factory.Config.PropertyPathFactoryObject, Spring.Core" />

Requirements

Namespace: Spring.Objects.Factory.Config

Assembly: Spring.Core (in Spring.Core.dll)

See Also

PropertyPathFactoryObject Members | Spring.Objects.Factory.Config Namespace