java.lang.Object
ml.karmaconfigs.api.common.karma.loader.component.NameComponent

public final class NameComponent extends Object
Karma name component for file/directory purposes
  • Method Details

    • addParentStart

      public void addParentStart(String parent)
      Add a parent directory at the start of parent directory tree
      Parameters:
      parent - the parent directory
    • addParentEnd

      public void addParentEnd(String parent)
      Add a parent directory at the end of parent directory tree
      Parameters:
      parent - the parent directory
    • getName

      public String getName()
      Get the component name
      Returns:
      the component name
    • findExtension

      public String findExtension()
      Find any extension in the component
      Returns:
      the component extension ( if present )
    • getParent

      public Path getParent(Path start)
      Get the parent directories
      Parameters:
      start - the start directory
      Returns:
      the parent directory tree
    • getParents

      public String[] getParents()
      Get the parent directories
      Returns:
      the parent directories tree
    • hasParents

      public boolean hasParents()
      Get if the component has parent directories
      Returns:
      if the component has parent directories
    • hasExtension

      public boolean hasExtension()
      Get if the component has extension
      Returns:
      if the component has a extension
    • isDirectory

      public boolean isDirectory()
      Get if the component is a directory
      Returns:
      if the component is a directory
    • fromFile

      public static NameComponent fromFile(File file)
      Create a name component from file
      Parameters:
      file - the file
      Returns:
      the file name component
    • fromPath

      public static NameComponent fromPath(Path file)
      Create a name component from path file
      Parameters:
      file - the file
      Returns:
      the file name component
    • forFile

      public static NameComponent forFile(CharSequence name, String extension, String... subDirectory)
      Create a new name component for file purposes
      Parameters:
      name - the file name
      extension - the file extension
      subDirectory - the file parent directory tree
      Returns:
      the file name component
    • forDirectory

      public static NameComponent forDirectory(CharSequence name)
      Create a new name component for directory purposes
      Parameters:
      name - the directory name
      Returns:
      the directory name component