public enum OperatingSystem extends Enum<OperatingSystem>
Modifier and Type | Method and Description |
---|---|
static OperatingSystem |
detect()
Detects the current operating system.
|
static boolean |
isLinux()
Checks if
System.getProperty("os.name") returns a value that contains "linux" or "nix"
(ignoring case). |
static boolean |
isMac()
Checks if
System.getProperty("os.name") returns a value that contains "mac" (ignoring case). |
static boolean |
isOther()
Checks if
System.getProperty("os.name") returns a value that does not match the other operating system
name patterns. |
static boolean |
isWindows()
Checks if
System.getProperty("os.name") returns a value that contains "windows" (ignoring case). |
static OperatingSystem |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static OperatingSystem[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final OperatingSystem LINUX
public static final OperatingSystem WINDOWS
public static final OperatingSystem MACOSX
public static final OperatingSystem OTHER
public static OperatingSystem[] values()
for (OperatingSystem c : OperatingSystem.values()) System.out.println(c);
public static OperatingSystem valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static OperatingSystem detect()
public static boolean isLinux()
System.getProperty("os.name")
returns a value that contains "linux"
or "nix"
(ignoring case).true
if this is the case, false
otherwisepublic static boolean isMac()
System.getProperty("os.name")
returns a value that contains "mac"
(ignoring case).true
if this is the case, false
otherwisepublic static boolean isWindows()
System.getProperty("os.name")
returns a value that contains "windows"
(ignoring case).true
if this is the case, false
otherwisepublic static boolean isOther()
System.getProperty("os.name")
returns a value that does not match the other operating system
name patterns.true
if this is the case, false
otherwiseCopyright © 2011–2021 aiticon GmbH. All rights reserved.