Class Docs

java.lang.Object
io.nosqlbench.nb.api.docsapi.Docs
All Implemented Interfaces:
DocsBinder, Iterable<DocsNameSpace>

public class Docs extends Object implements DocsBinder
The Docs class is a utility class that makes it easy to enumerate docs for a component. The primary info type which is used by the doc system is the DocsBinder. A DocsBinder contains zero or more DocsNameSpace. A DocsNameSpace has a name, a set of paths, and a flag that sets it enabled or disabled by default.
  • Constructor Details

    • Docs

      public Docs()
  • Method Details

    • forRoot

      public static DocsBinder forRoot(String namespace, Path root)
    • empty

      public static DocsBinder empty()
    • namespace

      public Docs namespace(String namespace)
    • addFirstFoundContentPath

      public Docs addFirstFoundContentPath(String... potentials)
    • addFirstFoundPath

      public Docs addFirstFoundPath(String... potentials)
    • addContentsOf

      public Docs addContentsOf(Path root)
      Add each contained path within the specified directory path. Only the top-level elements are added. This serves to relativize any content added this way so that the owning directory is not included itself by name.
      Parameters:
      root - The root of the content to add.
      Returns:
      this Docs, for method chaining
    • addPath

      public Docs addPath(Path path)
    • setEnabledByDefault

      public Docs setEnabledByDefault(boolean enabledByDefault)
    • merge

      public DocsBinder merge(DocsBinder other)
      Description copied from interface: DocsBinder
      The result of merging two DocsInfo elements together is a combined DocsInfo element with all unique namespaces occurring exactly once, and with the other namespace overwriting same-named namespaces in the original element.
      Specified by:
      merge in interface DocsBinder
      Parameters:
      other - The DocsInfo containing namespaces to overlay into this DocsInfo
      Returns:
    • merge

      public DocsBinder merge(DocsNameSpace namespace)
      Description copied from interface: DocsBinder
      The result of merging a DocPathInfo entry into a DocsInfo element is the combined DocsInfo element with the added entry overwriting any namespace of the same name.
      Specified by:
      merge in interface DocsBinder
      Parameters:
      namespace - The namespace entry to overlay into this DocsInfo
      Returns:
    • getPaths

      public List<Path> getPaths()
      Specified by:
      getPaths in interface DocsBinder
      Returns:
      All paths in all namespaces are returned, in no guaranteed order.
    • getPathMap

      public Map<String,Set<Path>> getPathMap()
      Specified by:
      getPathMap in interface DocsBinder
      Returns:
      A map of all namespaces to each set of provided paths is returned.
    • getNamespaces

      public List<DocsNameSpace> getNamespaces()
      Specified by:
      getNamespaces in interface DocsBinder
    • iterator

      public Iterator<DocsNameSpace> iterator()
      Specified by:
      iterator in interface Iterable<DocsNameSpace>
    • getPathMaps

      public Map<String,Set<Path>> getPathMaps()
    • asDocsBinder

      public DocsBinder asDocsBinder()
    • remove

      public DocsBinder remove(Set<String> namespaces)
      Description copied from interface: DocsBinder
      The result of removing a set of namespaces from a DocsInfo element is a new DocsInfo element containing only the namespaces which were removed. The original DocsInfo element is modified statefully in this case. It is not an error to remove namespaces which are not present in the original DocsInfo. If this condition is important, check for it manually.
      Specified by:
      remove in interface DocsBinder
      Parameters:
      namespaces - The names of the namespaces to remove, should they be present.
      Returns:
      A new DocsInfo object representing what was actually removed.