Class LastDirectories
Derives a name by taking the filename together with optionally several subdirectories names.
The subdirectory names to use are limited by a certain number, working backwards from the filename to the file-system root.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionLastDirectories(int numberSubdirectories) Creates for a particular number of subdirectories. -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckMisconfigured(BeanInstanceMap defaultInstances) Checks that a bean's properties conform to expectations.protected StringderiveName(File file, Optional<Path> inputDirectory, int index) Derives a unique name for this file.intHow many directories to include in the name.intInitially skip this number of directories before including them in the description.booleanWhether to remove the file-extension from the filename.booleanIff true the filename is not considered, only the subdirectories.voidsetNumberSubdirectories(int numberSubdirectories) How many directories to include in the name.voidsetRemoveExtensionInDescription(boolean removeExtensionInDescription) Whether to remove the file-extension from the filename.voidsetSkipFileName(boolean skipFileName) Iff true the filename is not considered, only the subdirectories.voidsetSkipNumberSubdirectories(int skipNumberSubdirectories) Initially skip this number of directories before including them in the description.Methods inherited from class org.anchoranalysis.io.input.bean.namer.FileNamerIndependent
deriveNameMethods inherited from class org.anchoranalysis.io.input.bean.namer.FileNamer
deriveName, deriveNameUniqueMethods inherited from class org.anchoranalysis.bean.AnchorBean
describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
LastDirectories
public LastDirectories(int numberSubdirectories) Creates for a particular number of subdirectories.- Parameters:
numberSubdirectories- the number of subdirectories
-
LastDirectories
public LastDirectories()
-
-
Method Details
-
checkMisconfigured
Description copied from class:AnchorBeanChecks that a bean's properties conform to expectations.- Overrides:
checkMisconfiguredin classAnchorBean<FileNamer>- Parameters:
defaultInstances- all available default instances if theDefaultInstanceannotation is used- Throws:
BeanMisconfiguredException- if the bean has not been configured properly as XML
-
deriveName
Description copied from class:FileNamerIndependentDerives a unique name for this file.- Specified by:
deriveNamein classFileNamerIndependent- Parameters:
file- the file.inputDirectory- the root input-directory used in naming.index- a unique incrementing number, beginning at zero, passed to each call to this method within a collection.- Returns:
- the derived unique name.
-
getNumberSubdirectories
public int getNumberSubdirectories()How many directories to include in the name.This refers to the last-most sub-directories i.e. working backwards from the filename to the file-system root.
-
setNumberSubdirectories
public void setNumberSubdirectories(int numberSubdirectories) How many directories to include in the name.This refers to the last-most sub-directories i.e. working backwards from the filename to the file-system root.
-
isRemoveExtensionInDescription
public boolean isRemoveExtensionInDescription()Whether to remove the file-extension from the filename. -
setRemoveExtensionInDescription
public void setRemoveExtensionInDescription(boolean removeExtensionInDescription) Whether to remove the file-extension from the filename. -
getSkipNumberSubdirectories
public int getSkipNumberSubdirectories()Initially skip this number of directories before including them in the description.This refers to the last-most directories i.e. working backwards from the filename to the file-system root.
-
setSkipNumberSubdirectories
public void setSkipNumberSubdirectories(int skipNumberSubdirectories) Initially skip this number of directories before including them in the description.This refers to the last-most directories i.e. working backwards from the filename to the file-system root.
-
isSkipFileName
public boolean isSkipFileName()Iff true the filename is not considered, only the subdirectories. -
setSkipFileName
public void setSkipFileName(boolean skipFileName) Iff true the filename is not considered, only the subdirectories.
-