Class PropertyVisitor
Base class for implementing algorithms using properties. This is an abstract class.
Namespace: Unity.Properties
Syntax
public abstract class PropertyVisitor : object, IPropertyBagVisitor, IListPropertyBagVisitor, IDictionaryPropertyBagVisitor, IPropertyVisitor, ICollectionPropertyVisitor, IListPropertyVisitor, ISetPropertyVisitor, IDictionaryPropertyVisitor, IVisitor
Methods
AddAdapter(IPropertyVisitorAdapter)
Adds an adapter to the visitor.
Declaration
public void AddAdapter(IPropertyVisitorAdapter adapter)
Parameters
Type | Name | Description |
---|---|---|
IPropertyVisitorAdapter | adapter | The adapter to add. |
IsExcluded<TContainer, TValue>(Property<TContainer, TValue>, ref TContainer, ref TValue)
Called before visiting each property to determine if the property should be visited.
Declaration
protected virtual bool IsExcluded<TContainer, TValue>(Property<TContainer, TValue> property, ref TContainer container, ref TValue value)
Parameters
Type | Name | Description |
---|---|---|
Property<TContainer, TValue> | property | The property providing access to the data. |
TContainer | container | The container being visited. |
TValue | value | The value being visited. |
Returns
Type | Description |
---|---|
Boolean |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TValue | The value type. |
Remarks
This method is called after all IExclude<TValue> have had a chance to run.
RemoveAdapter(IPropertyVisitorAdapter)
Removes an adapter from the visitor.
Declaration
public void RemoveAdapter(IPropertyVisitorAdapter adapter)
Parameters
Type | Name | Description |
---|---|---|
IPropertyVisitorAdapter | adapter | The adapter to remove. |
VisitCollection<TContainer, TCollection, TElement>(Property<TContainer, TCollection>, ref TContainer, ref TCollection)
Called when visiting any non-specialized collection property.
Declaration
protected virtual void VisitCollection<TContainer, TCollection, TElement>(Property<TContainer, TCollection> property, ref TContainer container, ref TCollection value)
where TCollection : ICollection<TElement>
Parameters
Type | Name | Description |
---|---|---|
Property<TContainer, TCollection> | property | The property providing access to the collection. |
TContainer | container | The container being visited. |
TCollection | value | The collection being visited. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TCollection | The collection type. |
TElement | The element type. |
Remarks
When visiting a specialized collection the appropriate method will be called.
VisitDictionary<TContainer, TDictionary, TKey, TValue>(Property<TContainer, TDictionary>, ref TContainer, ref TDictionary)
Called when visiting a specialized dictionary property.
Declaration
protected virtual void VisitDictionary<TContainer, TDictionary, TKey, TValue>(Property<TContainer, TDictionary> property, ref TContainer container, ref TDictionary value)
where TDictionary : IDictionary<TKey, TValue>
Parameters
Type | Name | Description |
---|---|---|
Property<TContainer, TDictionary> | property | The property providing access to the dictionary. |
TContainer | container | The container being visited. |
TDictionary | value | The dictionary being visited. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TDictionary | The dictionary type. |
TKey | The key type. |
TValue | The value type. |
VisitList<TContainer, TList, TElement>(Property<TContainer, TList>, ref TContainer, ref TList)
Called when visiting a specialized list property.
Declaration
protected virtual void VisitList<TContainer, TList, TElement>(Property<TContainer, TList> property, ref TContainer container, ref TList value)
where TList : IList<TElement>
Parameters
Type | Name | Description |
---|---|---|
Property<TContainer, TList> | property | The property providing access to the list. |
TContainer | container | The container being visited. |
TList | value | The list being visited. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TList | The list type. |
TElement | The element type. |
VisitProperty<TContainer, TValue>(Property<TContainer, TValue>, ref TContainer, ref TValue)
Called when visiting any leaf property with no specialized handling.
Declaration
protected virtual void VisitProperty<TContainer, TValue>(Property<TContainer, TValue> property, ref TContainer container, ref TValue value)
Parameters
Type | Name | Description |
---|---|---|
Property<TContainer, TValue> | property | The property providing access to the value. |
TContainer | container | The container being visited. |
TValue | value | The value being visited. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TValue | The value type. |
VisitSet<TContainer, TSet, TValue>(Property<TContainer, TSet>, ref TContainer, ref TSet)
Called when visiting a specialized set property.
Declaration
protected virtual void VisitSet<TContainer, TSet, TValue>(Property<TContainer, TSet> property, ref TContainer container, ref TSet value)
where TSet : ISet<TValue>
Parameters
Type | Name | Description |
---|---|---|
Property<TContainer, TSet> | property | The property providing access to the list. |
TContainer | container | The container being visited. |
TSet | value | The list being visited. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TSet | The set type. |
TValue | The element type. |