Class PropertyVisitor
Base class for implementing algorithms using properties. This is an abstract class.
Inherited Members
Namespace: Unity.Properties
Syntax
public abstract class PropertyVisitor : IPropertyBagVisitor, IListPropertyBagVisitor, IDictionaryPropertyBagVisitor, IPropertyVisitor, ICollectionPropertyVisitor, IListPropertyVisitor, ISetPropertyVisitor, IDictionaryPropertyVisitor
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 IExcludePropertyAdapter<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. |
Explicit Interface Implementations
ICollectionPropertyVisitor.Visit<TContainer, TCollection, TElement>(Property<TContainer, TCollection>, ref TContainer, ref TCollection)
Implement this method to accept visitation for a specialized collection property.
Declaration
void ICollectionPropertyVisitor.Visit<TContainer, TCollection, TElement>(Property<TContainer, TCollection> property, ref TContainer container, ref TCollection collection)
where TCollection : ICollection<TElement>
Parameters
Type | Name | Description |
---|---|---|
Property<TContainer, TCollection> | property | The property being visited. |
TContainer | container | The container being visited. |
TCollection | collection | The collection value. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TCollection | The collection value type. |
TElement | The collection element type. |
Implements
Remarks
This method is invoked by ICollectionPropertyAccept<TCollection>
IDictionaryPropertyBagVisitor.Visit<TDictionary, TKey, TValue>(IDictionaryPropertyBag<TDictionary, TKey, TValue>, ref TDictionary)
Implement this method to accept visitation for a collection of properties.
Declaration
void IDictionaryPropertyBagVisitor.Visit<TDictionary, TKey, TValue>(IDictionaryPropertyBag<TDictionary, TKey, TValue> properties, ref TDictionary container)
where TDictionary : IDictionary<TKey, TValue>
Parameters
Type | Name | Description |
---|---|---|
IDictionaryPropertyBag<TDictionary, TKey, TValue> | properties | The properties of the container. |
TDictionary | container | The container being visited. |
Type Parameters
Name | Description |
---|---|
TDictionary | The dictionary type. |
TKey | The key type. |
TValue | The value type. |
Implements
Remarks
This method is invoked by IDictionaryPropertyBagAccept<TContainer>.
IDictionaryPropertyVisitor.Visit<TContainer, TDictionary, TKey, TValue>(Property<TContainer, TDictionary>, ref TContainer, ref TDictionary)
Implement this method to accept visitation for a specialized dictionary property.
Declaration
void IDictionaryPropertyVisitor.Visit<TContainer, TDictionary, TKey, TValue>(Property<TContainer, TDictionary> property, ref TContainer container, ref TDictionary dictionary)
where TDictionary : IDictionary<TKey, TValue>
Parameters
Type | Name | Description |
---|---|---|
Property<TContainer, TDictionary> | property | The property being visited. |
TContainer | container | The container being visited. |
TDictionary | dictionary | The dictionary value. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TDictionary | The dictionary value type. |
TKey | The key type. |
TValue | The value type. |
Implements
Remarks
This method is invoked by IDictionaryPropertyAccept<TDictionary>
IListPropertyBagVisitor.Visit<TList, TElement>(IListPropertyBag<TList, TElement>, ref TList)
Implement this method to accept visitation for a collection of properties.
Declaration
void IListPropertyBagVisitor.Visit<TList, TElement>(IListPropertyBag<TList, TElement> properties, ref TList container)
where TList : IList<TElement>
Parameters
Type | Name | Description |
---|---|---|
IListPropertyBag<TList, TElement> | properties | The properties of the container. |
TList | container | The container being visited. |
Type Parameters
Name | Description |
---|---|
TList | The list type. |
TElement | The element type. |
Implements
Remarks
This method is invoked by Accept(IListPropertyBagVisitor, ref TContainer).
IListPropertyVisitor.Visit<TContainer, TList, TElement>(Property<TContainer, TList>, ref TContainer, ref TList)
Implement this method to accept visitation for a specialized list property.
Declaration
void IListPropertyVisitor.Visit<TContainer, TList, TElement>(Property<TContainer, TList> property, ref TContainer container, ref TList list)
where TList : IList<TElement>
Parameters
Type | Name | Description |
---|---|---|
Property<TContainer, TList> | property | The property being visited. |
TContainer | container | The container being visited. |
TList | list | The list value. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TList | The list value type. |
TElement | The collection element type. |
Implements
Remarks
This method is invoked by IListPropertyAccept<TList>
IPropertyBagVisitor.Visit<TContainer>(IPropertyBag<TContainer>, ref TContainer)
Implement this method to accept visitation for a property bag and container.
Declaration
void IPropertyBagVisitor.Visit<TContainer>(IPropertyBag<TContainer> properties, ref TContainer container)
Parameters
Type | Name | Description |
---|---|---|
IPropertyBag<TContainer> | properties | The properties of the container. |
TContainer | container | The container being visited. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
Implements
Remarks
This method is invoked by Accept(IPropertyBagVisitor, ref TContainer).
IPropertyVisitor.Visit<TContainer, TValue>(Property<TContainer, TValue>, ref TContainer)
Implement this method to accept visitation for a specific property.
Declaration
void IPropertyVisitor.Visit<TContainer, TValue>(Property<TContainer, TValue> property, ref TContainer container)
Parameters
Type | Name | Description |
---|---|---|
Property<TContainer, TValue> | property | The property being visited. |
TContainer | container | The container being visited. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TValue | The value type. |
Implements
Remarks
This method is invoked by IPropertyAccept<TContainer>
ISetPropertyVisitor.Visit<TContainer, TSet, TValue>(Property<TContainer, TSet>, ref TContainer, ref TSet)
Implement this method to accept visitation for a specialized set property.
Declaration
void ISetPropertyVisitor.Visit<TContainer, TSet, TElement>(Property<TContainer, TSet> property, ref TContainer container, ref TSet set)
where TSet : ISet<TElement>
Parameters
Type | Name | Description |
---|---|---|
Property<TContainer, TSet> | property | The property being visited. |
TContainer | container | The container being visited. |
TSet | set | The hash set value. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TSet | The set value type. |
TElement |
Implements
Remarks
This method is invoked by ISetPropertyAccept<TSet>