Skip to content

CompositeListener<TContext, TBaseNode> Class

Definition

A Listener<TContext, TNode> built from multiple other listeners that listen to specific node types. When a node is reached the listener with the most specific type for the node will be used. Only a single listener will ever listen to a node. If no suitable listener is found the node will be ignored but it's descendents will still be listened to.

public sealed class CompositeListener<TContext, TBaseNode> : Listener<TContext, TBaseNode>, ICompositeListenerBuilder<TContext, TBaseNode>
   where TBaseNode : Node<TBaseNode>

View source

Type Parameters

Name Description
TContext The type of the context object.
TBaseNode The base type of all nodes in the tree.

Methods

Name Description
AfterListenToNode(TContext, TBaseNode) Called after a node and its descendents have been listened to.
BeforeListenToNode(TContext, TBaseNode) Called before a node and its descendents are listened to.
Build() Fluent interface to build a CompositeListener<TContext, TBaseNode>.
ListenToNode(TContext, TBaseNode) Called when the node is listened to.
ShouldListenToChildren(TContext, TBaseNode) Return a value indicating whether child nodes should be listened to or not. Defaults to true.