- All Implemented Interfaces:
Serializable,Comparable<Platform>,java.lang.constant.Constable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic PlatformReturns the current platform where the JVM is runningbooleanisUnix()Determine if the platform is unix-like.toString()Object string representationstatic PlatformReturns the enum constant of this class with the specified name.static Platform[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
LINUX
Linux platform -
MACOS
Any macOS platform -
SOLARIS
Solaris platform -
WINDOWS
Windows platform -
FREE_BSD
Free BSD platform -
UNKNOWN
Unknown platform. Used only to represent an error
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
isUnix
public boolean isUnix()Determine if the platform is unix-like.Example:
Platform current = Platform.getCurrent(); // Check unix platform boolean isUnix = current.isUnix();- Returns:
- Returns
trueif platform is unix-like orfalseotherwise
-
getCurrent
Returns the current platform where the JVM is running- Returns:
- Returns the platform where the JVM runs or
UNKNOWNif the platform is not listed
-
toString
Object string representation
-