@Test public void nodeCannotBeNull() { ServiceTree serviceTree = new ServiceTree(); try { serviceTree.createChildNode(null, "key"); } catch(NullPointerException e) { } }
@NonNull public Node createChildNode(@NonNull Node parentNode, @NonNull Object nodeKey) { checkNode(parentNode); checkKey(nodeKey); Node node = new Node(this, parentNode, nodeKey); parentNode.children.add(node); this.addNode(node); return node; }
ServiceTree { @NonNull public Node createChildNode(@NonNull Node parentNode, @NonNull Object nodeKey) { checkNode(parentNode); checkKey(nodeKey); Node node = new Node(this, parentNode, nodeKey); parentNode.children.add(node); this.addNode(node); return node; } }
ServiceTree { @NonNull public Node createChildNode(@NonNull Node parentNode, @NonNull Object nodeKey) { checkNode(parentNode); checkKey(nodeKey); Node node = new Node(this, parentNode, nodeKey); parentNode.children.add(node); this.addNode(node); return node; }  }
ServiceTree { @NonNull public Node createChildNode(@NonNull Node parentNode, @NonNull Object nodeKey) { checkNode(parentNode); checkKey(nodeKey); Node node = new Node(this, parentNode, nodeKey); parentNode.children.add(node); this.addNode(node); return node; }  boolean hasNodeWithKey(@NonNull Object key); @NonNull Node createRootNode(@NonNull Object nodeKey); @NonNull Node createChildNode(@NonNull Node parentNode, @NonNull Object nodeKey); @NonNull Node getNode(@NonNull Object key); void traverseTree(@Walk.Mode final int mode, @NonNull final Walk walk); void traverseTree(@Walk.Mode final int mode, boolean includeTreeRoot, @NonNull final Walk walk); void removeAllNodes(); void removeNodeAndChildren(@NonNull Node node); void traverseSubtree(@NonNull final Node node, @Walk.Mode final int mode, @NonNull final Walk walk); void traverseChain(@NonNull Node node, @NonNull Walk walk); void traverseChain(@NonNull Node node, boolean includeTreeRoot, @NonNull Walk walk); void traverseChain(@NonNull Node node, @Walk.Mode final int mode, @NonNull Walk walk); void traverseChain(@NonNull Node node, @Walk.Mode final int mode, final boolean includeTreeRoot, @NonNull Walk walk); @NonNull Node findRoot(@NonNull Node child); @NonNull Set<Object> getKeys(); Node getTreeRoot(); void registerRootService(@NonNull String name, @NonNull Object service); boolean hasRootService(String name); @NonNull T getRootService(String name); T unregisterRootService(String name); }
ServiceTree { @NonNull public Node createChildNode(@NonNull Node parentNode, @NonNull Object nodeKey) { checkNode(parentNode); checkKey(nodeKey); Node node = new Node(this, parentNode, nodeKey); parentNode.children.add(node); this.addNode(node); return node; }  boolean hasNodeWithKey(@NonNull Object key); @NonNull Node createRootNode(@NonNull Object nodeKey); @NonNull Node createChildNode(@NonNull Node parentNode, @NonNull Object nodeKey); @NonNull Node getNode(@NonNull Object key); void traverseTree(@Walk.Mode final int mode, @NonNull final Walk walk); void traverseTree(@Walk.Mode final int mode, boolean includeTreeRoot, @NonNull final Walk walk); void removeAllNodes(); void removeNodeAndChildren(@NonNull Node node); void traverseSubtree(@NonNull final Node node, @Walk.Mode final int mode, @NonNull final Walk walk); void traverseChain(@NonNull Node node, @NonNull Walk walk); void traverseChain(@NonNull Node node, boolean includeTreeRoot, @NonNull Walk walk); void traverseChain(@NonNull Node node, @Walk.Mode final int mode, @NonNull Walk walk); void traverseChain(@NonNull Node node, @Walk.Mode final int mode, final boolean includeTreeRoot, @NonNull Walk walk); @NonNull Node findRoot(@NonNull Node child); @NonNull Set<Object> getKeys(); Node getTreeRoot(); void registerRootService(@NonNull String name, @NonNull Object service); boolean hasRootService(String name); @NonNull T getRootService(String name); T unregisterRootService(String name);  }