Class ReportingNodeState

  • All Implemented Interfaces:

    public class ReportingNodeState
    extends AbstractDecoratedNodeState
    A decoration layer for NodeState instances that intercepts all accesses to NodeStates and PropertyStates (getters) and informs a Reporter via its callbacks that the respective NodeStates or PropertyStates have been accessed.
    The decoration is deep, i.e. any child NodeStates will be decorated as well and will report to the same Reporter instance.
    For convenience, a PeriodicReporter abstract class exists. This simplifies reporting every nth node/property only.
    Note: Multiple accesses to the same node or property are each reported. Therefore if exactly counting unique accesses is a requirement, the reporter needs to take care of de-duplication.
    See Also:
    Reporter, PeriodicReporter, LoggingReporter
    • Method Detail

      • wrap

        public static NodeState wrap​(NodeState nodeState,
                                     Reporter reporter)
        Allows wrapping a NodeState as a ReportingNodeState. The wrapped NodeState is treated as the root of a tree (i.e. path is "/").
        Any children accessed via this NodeState are also wrapped. Each wrapped NodeState is also reported to the provided Reporter.
        nodeState - The NodeState to be wrapped.
        reporter - The reporter to report to.
        the wrapped NodeState.
      • getPath

        public String getPath()
        ReportingNodeState instances provide access to their path via their parent hierarchy. Note that calculating the path on every access may incur a significant performance penalty.
        The path of the ReportingNodeState instance, assuming that the first wrapped instance is the root node.