Class Platform.Builder
java.lang.Object
be.imgn.gaia.platform.Platform.Builder
- Enclosing interface:
Platform
Detects a
Platform from its sources. Each source defaults to the running JVM's:
SystemProperties.system(), Environment.system() and FileSystems.getDefault().
The operating system comes from the os.name property; any value not recognized as Linux, macOS or
Windows is taken for another Unix-like system. Every path of the platform belongs to the file system.
-
Method Summary
Modifier and TypeMethodDescriptiondetect()Detects the platform from this builder's sources.environment(Environment environment) Sets the environment variables to read.fileSystem(FileSystem fileSystem) Sets the file system the platform's paths belong to.systemProperties(SystemProperties systemProperties) Sets the system properties to read;os.nameanduser.homeare required.
-
Method Details
-
systemProperties
Sets the system properties to read;os.nameanduser.homeare required.- Parameters:
systemProperties- the system properties- Returns:
- this builder
-
environment
Sets the environment variables to read.- Parameters:
environment- the environment variables- Returns:
- this builder
-
fileSystem
Sets the file system the platform's paths belong to.- Parameters:
fileSystem- the file system- Returns:
- this builder
-
detect
Detects the platform from this builder's sources. The sources are read now; later changes to them do not affect the platform.- Returns:
- the platform
- Throws:
NoSuchElementException- ifos.nameoruser.homeis not setInvalidPathException- ifuser.home, or an environment variable the platform reads a directory from, is not a valid path on the file system
-