Class NameComponent
java.lang.Object
ml.karmaconfigs.api.common.karma.loader.component.NameComponent
Karma name component for file/directory
purposes
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddParentEnd(String parent)Add a parent directory at the end of parent directory treevoidaddParentStart(String parent)Add a parent directory at the start of parent directory treeFind any extension in the componentstatic NameComponentforDirectory(CharSequence name)Create a new name component for directory purposesstatic NameComponentforFile(CharSequence name, String extension, String... subDirectory)Create a new name component for file purposesstatic NameComponentCreate a name component from filestatic NameComponentCreate a name component from path filegetName()Get the component nameGet the parent directoriesString[]Get the parent directoriesbooleanGet if the component has extensionbooleanGet if the component has parent directoriesbooleanGet if the component is a directory
-
Method Details
-
addParentStart
Add a parent directory at the start of parent directory tree- Parameters:
parent- the parent directory
-
addParentEnd
Add a parent directory at the end of parent directory tree- Parameters:
parent- the parent directory
-
getName
Get the component name- Returns:
- the component name
-
findExtension
Find any extension in the component- Returns:
- the component extension ( if present )
-
getParent
Get the parent directories- Parameters:
start- the start directory- Returns:
- the parent directory tree
-
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
Create a name component from file- Parameters:
file- the file- Returns:
- the file name component
-
fromPath
Create a name component from path file- Parameters:
file- the file- Returns:
- the file name component
-
forFile
Create a new name component for file purposes- Parameters:
name- the file nameextension- the file extensionsubDirectory- the file parent directory tree- Returns:
- the file name component
-
forDirectory
Create a new name component for directory purposes- Parameters:
name- the directory name- Returns:
- the directory name component
-