Package org.anchoranalysis.io.input.file
Class NamedFile
Object
org.anchoranalysis.io.input.file.NamedFile
public final class NamedFile extends Object
A file with an associated unique name.
This is an immutable class.
The name is intended to be a compact unique identifier for a file (in a particular context).
- Author:
- Owen Feehan
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description booleanequals(Object o)FilegetFile()The file.StringgetIdentifier()Unique identifier associated with the file.PathgetPath()The path ofgetFile().inthashCode()NamedFilemapIdentifier(BiFunction<String,File,String> function)Immutably renames the file, by assigning it a new identifier.PathtoPath()LikeFile.toPath().StringtoString()
-
Constructor Details
-
NamedFile
Create with an identifier and a file.- Parameters:
identifier- unique identifier associated with the file.file- the file.
-
-
Method Details
-
getPath
The path ofgetFile().- Returns:
- the path
-
mapIdentifier
Immutably renames the file, by assigning it a new identifier.- Parameters:
function- generates a new identifier from the existing identifier and file- Returns:
- a newly created file with the assigned identifier, but existing file.
-
toPath
LikeFile.toPath().- Returns:
- the path associated with the file.
-
getIdentifier
Unique identifier associated with the file. -
getFile
The file. -
equals
-
hashCode
public int hashCode() -
toString
-