Package org.terracotta.context
Class ContextAwareTreeNode
- java.lang.Object
-
- org.terracotta.context.ContextAwareTreeNode
-
- All Implemented Interfaces:
TreeNode,WeakIdentityHashMap.Cleanable
class ContextAwareTreeNode extends java.lang.Object implements TreeNode
Node used to wrap real tree node to keep the context object. Only used byContextManager.nodeFor(Object)to allow the fluent interface to forward the context toTreeNodemethods.Currently, the only method using it is
clean()that will make sure the context is removed from thePassThroughStatistic
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Objectcontextprivate TreeNodewrappedNode
-
Constructor Summary
Constructors Constructor Description ContextAwareTreeNode(TreeNode node, java.lang.Object context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclean()java.util.Set<? extends TreeNode>getChildren()Returns the immediate children of this context.ContextElementgetContext()Returns the context information associated with this node.java.util.List<? extends TreeNode>getPath()Returns the unique rooting path of this context element.java.util.Collection<java.util.List<? extends TreeNode>>getPaths()Returns the complete set of rooting paths for this context element.java.lang.StringtoTreeString()
-
-
-
Field Detail
-
context
private final java.lang.Object context
-
wrappedNode
private final TreeNode wrappedNode
-
-
Constructor Detail
-
ContextAwareTreeNode
public ContextAwareTreeNode(TreeNode node, java.lang.Object context)
-
-
Method Detail
-
getChildren
public java.util.Set<? extends TreeNode> getChildren()
Description copied from interface:TreeNodeReturns the immediate children of this context.- Specified by:
getChildrenin interfaceTreeNode- Returns:
- the context children
-
getPath
public java.util.List<? extends TreeNode> getPath() throws java.lang.IllegalStateException
Description copied from interface:TreeNodeReturns 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
IllegalStateExceptionwill be thrown.
-
getPaths
public java.util.Collection<java.util.List<? extends TreeNode>> getPaths()
Description copied from interface:TreeNodeReturns the complete set of rooting paths for this context element.
-
getContext
public ContextElement getContext()
Description copied from interface:TreeNodeReturns the context information associated with this node.- Specified by:
getContextin interfaceTreeNode- Returns:
- node context information
-
toTreeString
public java.lang.String toTreeString()
- Specified by:
toTreeStringin interfaceTreeNode
-
clean
public void clean()
- Specified by:
cleanin interfaceWeakIdentityHashMap.Cleanable
-
-