Class ContextAwareTreeNode

java.lang.Object
org.terracotta.context.ContextAwareTreeNode
All Implemented Interfaces:
TreeNode, WeakIdentityHashMap.Cleanable

class ContextAwareTreeNode extends Object implements TreeNode
Node used to wrap real tree node to keep the context object. Only used by ContextManager.nodeFor(Object) to allow the fluent interface to forward the context to TreeNode methods.

Currently, the only method using it is clean() that will make sure the context is removed from the PassThroughStatistic<T extends Serializable>

  • Field Details

    • context

      private final Object context
    • wrappedNode

      private final TreeNode wrappedNode
  • Constructor Details

    • ContextAwareTreeNode

      public ContextAwareTreeNode(TreeNode node, Object context)
  • Method Details

    • getChildren

      public Set<? extends TreeNode> getChildren()
      Description copied from interface: TreeNode
      Returns the immediate children of this context.
      Specified by:
      getChildren in interface TreeNode
      Returns:
      the context children
    • getPath

      public List<? extends TreeNode> getPath() throws IllegalStateException
      Description copied from interface: TreeNode
      Returns the unique rooting path of this context element.

      If this context element is not connected to a root in any ContextManager instance or is rooted via multiple distinct paths then an IllegalStateException will be thrown.

      Specified by:
      getPath in interface TreeNode
      Returns:
      the unique rooting path
      Throws:
      IllegalStateException - if the context is not uniquely rooted
    • getPaths

      public Collection<List<? extends TreeNode>> getPaths()
      Description copied from interface: TreeNode
      Returns the complete set of rooting paths for this context element.
      Specified by:
      getPaths in interface TreeNode
      Returns:
      the set of rooting paths
    • getContext

      public ContextElement getContext()
      Description copied from interface: TreeNode
      Returns the context information associated with this node.
      Specified by:
      getContext in interface TreeNode
      Returns:
      node context information
    • toTreeString

      public String toTreeString()
      Specified by:
      toTreeString in interface TreeNode
    • clean

      public void clean()
      Specified by:
      clean in interface WeakIdentityHashMap.Cleanable