Class LocalFileSystemAdapter
java.lang.Object
com.pragma.archetype.infrastructure.adapter.out.filesystem.LocalFileSystemAdapter
- All Implemented Interfaces:
FileSystemPort
Adapter for local file system operations.
Implements FileSystemPort using Java NIO.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.pragma.archetype.domain.port.out.FileSystemPort
FileSystemPort.FileWriteException -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendToFile(Path path, String content) Appends content to an existing file.voidcreateDirectory(Path path) Creates a directory.booleandirectoryExists(Path path) Checks if a directory exists.booleanChecks if a path exists.booleanisProjectEmpty(Path path) Checks if a directory is empty (only contains Gradle files).Lists files in a directory.Reads the content of a file.voidwriteFile(GeneratedFile file) Writes a file to the file system.voidwriteFiles(List<GeneratedFile> files) Writes multiple files to the file system.
-
Constructor Details
-
LocalFileSystemAdapter
public LocalFileSystemAdapter()
-
-
Method Details
-
writeFile
Description copied from interface:FileSystemPortWrites a file to the file system.- Specified by:
writeFilein interfaceFileSystemPort- Parameters:
file- the file to write
-
writeFiles
Description copied from interface:FileSystemPortWrites multiple files to the file system.- Specified by:
writeFilesin interfaceFileSystemPort- Parameters:
files- the files to write
-
createDirectory
Description copied from interface:FileSystemPortCreates a directory.- Specified by:
createDirectoryin interfaceFileSystemPort- Parameters:
path- the directory path
-
exists
Description copied from interface:FileSystemPortChecks if a path exists.- Specified by:
existsin interfaceFileSystemPort- Parameters:
path- the path to check- Returns:
- true if exists, false otherwise
-
directoryExists
Description copied from interface:FileSystemPortChecks if a directory exists.- Specified by:
directoryExistsin interfaceFileSystemPort- Parameters:
path- the directory path- Returns:
- true if exists and is a directory, false otherwise
-
isProjectEmpty
Description copied from interface:FileSystemPortChecks if a directory is empty (only contains Gradle files).- Specified by:
isProjectEmptyin interfaceFileSystemPort- Parameters:
path- the directory path- Returns:
- true if empty or only contains allowed files, false otherwise
-
listFiles
Description copied from interface:FileSystemPortLists files in a directory.- Specified by:
listFilesin interfaceFileSystemPort- Parameters:
path- the directory path- Returns:
- list of file paths
-
readFile
Description copied from interface:FileSystemPortReads the content of a file.- Specified by:
readFilein interfaceFileSystemPort- Parameters:
path- the file path- Returns:
- the file content as string
-
appendToFile
Description copied from interface:FileSystemPortAppends content to an existing file.- Specified by:
appendToFilein interfaceFileSystemPort- Parameters:
path- the file pathcontent- the content to append
-