/** * Returns an instance with the detached flag set to true. This method * is called if the selector of a tracked node does not match a single * node any more. It is possible to pass in a new node instance which * becomes the current tracked node. If this is <b>null</b>, the * previous node instance is used. * * @param newNode the new tracked node instance (may be <b>null</b>) * @return the updated instance */ public TrackedNodeData detach(final ImmutableNode newNode) { final ImmutableNode newTrackedNode = (newNode != null) ? newNode : getNode(); return new TrackedNodeData(newTrackedNode, observerCount, new InMemoryNodeModel(newTrackedNode)); } }
/** * Creates an empty node derived from the passed in {@code TrackedNodeData} * object. This method is called if a tracked node got cleared by a * transaction. * * @param data the {@code TrackedNodeData} * @return the new node instance for this tracked node */ private static ImmutableNode createEmptyTrackedNode(final TrackedNodeData data) { return new ImmutableNode.Builder().name(data.getNode().getNodeName()) .create(); }
/** * Returns the current {@code ImmutableNode} instance associated with the * given selector. * * @param selector the {@code NodeSelector} * @return the {@code ImmutableNode} selected by this selector * @throws ConfigurationRuntimeException if no data for this selector is * available */ public ImmutableNode getTrackedNode(final NodeSelector selector) { return getTrackedNodeData(selector).getNode(); }