Class JavaConfig
-
- All Implemented Interfaces:
public final class JavaConfigSettings-group for Java-installations used by ServerPackCreator: the Java for modloader-server installs with validation and system-fallback, the per-version java-paths for script-variables, and the script-autoupdate flag. Extracted from ApiProperties (refactor Phase 1b); ApiProperties remains the facade through which consumers access these values.
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringJAVA_FOR_SERVER_INSTALL_KEYpublic final static StringSCRIPT_JAVA_PATHS_PREFIXpublic final static StringSCRIPT_JAVA_AUTOUPDATE_KEYprivate final BooleanfallbackJavaScriptAutoupdateEnabledprivate HashMap<String, String>javaPathsprivate BooleanisJavaScriptAutoupdateEnabledprivate StringjavaPath
-
Constructor Summary
Constructors Constructor Description JavaConfig(PropertyStore store)
-
Method Summary
Modifier and Type Method Description final BooleangetFallbackJavaScriptAutoupdateEnabled()final HashMap<String, String>getJavaPaths()final UnitsetJavaPaths(HashMap<String, String> values)final BooleanisJavaScriptAutoupdateEnabled()final UnitsetJavaScriptAutoupdateEnabled(Boolean value)final StringgetJavaPath()final UnitsetJavaPath(String value)final Optional<String>javaPath(Integer javaVersion)Get the path to the specified Java executable/binary, wrapped in an Optional for your convenience. final Optional<String>javaPath(String javaVersion)Get the path to the specified Java executable/binary, wrapped in an Optional for your convenience. final StringacquireJavaPath(String pathToJava)Check the given path to a Java installation for validity and return it, if it is valid. final BooleanjavaAvailable()Whether a viable path to a Java executable or binary has been configured for ServerPackCreator. -
-
Constructor Detail
-
JavaConfig
JavaConfig(PropertyStore store)
-
-
Method Detail
-
getFallbackJavaScriptAutoupdateEnabled
final Boolean getFallbackJavaScriptAutoupdateEnabled()
-
getJavaPaths
final HashMap<String, String> getJavaPaths()
-
setJavaPaths
final Unit setJavaPaths(HashMap<String, String> values)
-
isJavaScriptAutoupdateEnabled
final Boolean isJavaScriptAutoupdateEnabled()
-
setJavaScriptAutoupdateEnabled
final Unit setJavaScriptAutoupdateEnabled(Boolean value)
-
getJavaPath
final String getJavaPath()
-
setJavaPath
final Unit setJavaPath(String value)
-
javaPath
final Optional<String> javaPath(Integer javaVersion)
Get the path to the specified Java executable/binary, wrapped in an Optional for your convenience.
- Parameters:
javaVersion- The Java version to acquire the path for.- Returns:
The path to the Java executable/binary, if available.
-
javaPath
final Optional<String> javaPath(String javaVersion)
Get the path to the specified Java executable/binary, wrapped in an Optional for your convenience.
- Parameters:
javaVersion- The Java version to acquire the path for.- Returns:
The path to the Java executable/binary, if available.
-
acquireJavaPath
final String acquireJavaPath(String pathToJava)
Check the given path to a Java installation for validity and return it, if it is valid. If the passed path is a UNIX symlink or Windows lnk, it is resolved, then returned. If the passed path is considered invalid, the system default is acquired and returned.
- Parameters:
pathToJava- The path to check for whether it is a valid Java installation.- Returns:
Returns the path to the Java installation. If user input was incorrect, SPC will try to acquire the path automatically.
-
javaAvailable
final Boolean javaAvailable()
Whether a viable path to a Java executable or binary has been configured for ServerPackCreator.
- Returns:
trueif a viable path has been set.
-
-
-
-