Class NodeImpl

java.lang.Object
org.jboss.shrinkwrap.impl.base.NodeImpl
All Implemented Interfaces:
Node

public class NodeImpl extends Object implements Node
The default implementation of Node
  • Field Details

    • path

      private ArchivePath path
      The path of this node inside the Archive
    • asset

      private Asset asset
      The asset this node holds.
    • children

      private Set<Node> children
      The children nodes.
  • Constructor Details

    • NodeImpl

      public NodeImpl(ArchivePath path)
      Constructor This constructor will create a directory Node with the specified path.
      Parameters:
      path - The ArchivePath this Node is placed within the Archive
    • NodeImpl

      public NodeImpl(ArchivePath path, Asset asset)
      Constructor This constructor will create an asset Node with the specified path.
      Parameters:
      path - The ArchivePath this Node is placed within the Archive
      asset - The Asset that this Node holds.
  • Method Details

    • getPath

      public ArchivePath getPath()
      Specified by:
      getPath in interface Node
      Returns:
      The path where this node is placed within the Archive
    • getAsset

      public Asset getAsset()
      Specified by:
      getAsset in interface Node
      Returns:
      The Asset this node holds, null if it is an empty directory
    • getChildren

      public Set<Node> getChildren()
      Specified by:
      getChildren in interface Node
      Returns:
      The child nodes of this node or, an empty set if it has no children or holds an asset. This method will never return null. The returned Set will be an immutable view.
    • addChild

      public void addChild(Node node)
      Adds a child to the Set of nodes. If already exists, nothing happens.
      Parameters:
      node - The Node that will be added as a child
    • removeChild

      public void removeChild(Node node)
      Removes a child from the Set of nodes. If it doesn't exists, nothing happens.
      Parameters:
      node - The Node that will be removed from the childs
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object