public enum OS extends Enum<OS>
OS.Family
. Contains the current operating system and
utility methods to help deal with different operating systems.Modifier and Type | Class and Description |
---|---|
static class |
OS.Family
Families of operating systems, like Windows, Mac and Linux.
|
Enum Constant and Description |
---|
ARCH_LINUX |
CENTOS |
DEBIAN |
FEDORA |
GENTOO |
LINUX_MINT |
LINUX_UNKNOWN
An unknown or at least unrecognizable Linux based operating system.
|
MAC_OS_BIG_SUR |
MAC_OS_CATALINA |
MAC_OS_HIGH_SIERRA |
MAC_OS_MOJAVE |
MAC_OS_SIERRA |
MAC_OSX_CHEETAH |
MAC_OSX_EL_CAPITAN |
MAC_OSX_JAGUAR |
MAC_OSX_LEOPARD |
MAC_OSX_LION |
MAC_OSX_MAVERICKS |
MAC_OSX_MOUNTAIN_LION |
MAC_OSX_PANTHER |
MAC_OSX_PUMA |
MAC_OSX_SNOW_LEOPARD |
MAC_OSX_TIGER |
MAC_OSX_YOSEMITE |
MAC_UNKNOWN
An unknown or at least unrecognizable Mac based operating system.
|
RED_HAT_ENTERPRISE_LINUX |
SOLARIS
The Solaris operating system.
|
SUSE
Suse/OpenSUSE and any child-distributions.
|
UBUNTU |
UNKNOWN
An operating system that cannot be classified.
|
WIN_10 |
WIN_7 |
WIN_8 |
WIN_8_1 |
WIN_95 |
WIN_98 |
WIN_UNKNOWN
An unknown or at least unrecognizable Windows based operating system.
|
WIN_VISTA |
WIN_XP |
Modifier and Type | Method and Description |
---|---|
static OS |
current() |
void |
enforce(OS... operatingSystems)
Throws an
UnsupportedOSException if this operating system is not part of the given array. |
void |
enforceFamily(OS.Family... families)
Throws an
UnsupportedOSException if this OS is not part of the given families. |
void |
enforceNot(OS... operatingSystems)
Throws an
UnsupportedOSException if this operating system is part of the given array. |
void |
enforceNotFamily(OS.Family... families)
Throws an
UnsupportedOSException if this OS's family is part of the given families. |
OS.Family |
getFamily() |
boolean |
is(OS... operatingSystems)
Checks if this OS is part of the given array.
|
boolean |
isFamily(OS.Family... families)
Checks if this OS is part of the given families.
|
<T> T |
pick(T windows,
T mac,
T linux)
Picks one of the given values based on the
OS.Family of this operating system or throws an UnsupportedOSException if there is no value to represent it. |
<T> T |
pick(T windows,
T mac,
T linux,
T other)
Picks one of the given values based on the
OS.Family of this operating system. |
<T> T |
pickLinux(T linux)
Returns the given value if the
OS.Family of this OS is Linux or else throws an UnsupportedOSException . |
<T> T |
pickLinuxAny(T linux,
T anyOther)
Returns the given value if the
OS.Family of this operating system is Linux, or a default one. |
<T> T |
pickMac(T mac)
Returns the given value if the
OS.Family of this OS is Mac or else throws an UnsupportedOSException . |
<T> T |
pickMacAny(T mac,
T anyOther)
Returns the given value if the
OS.Family of this operating system is Mac, or a default one. |
<T> T |
pickMacLinux(T mac,
T linux)
Picks one of the given values based on the
OS.Family of this operating system or throws an UnsupportedOSException if there is no value to represent it. |
<T> T |
pickMacLinuxAny(T mac,
T linux,
T anyOther)
Picks one of the given values based on the
OS.Family of this operating system or a default one. |
<T> T |
pickWindows(T windows)
Returns the given value if the
OS.Family of this OS is Windows or else throws an UnsupportedOSException . |
<T> T |
pickWindowsAny(T windows,
T anyOther)
Returns the given value if the
OS.Family of this operating system is Windows, or a default one. |
<T> T |
pickWinLinux(T windows,
T linux)
Picks one of the given values based on the
OS.Family of this operating system or throws an UnsupportedOSException if there is no value to represent it. |
<T> T |
pickWinLinuxAny(T windows,
T linux,
T anyOther)
Picks one of the given values based on the
OS.Family of this operating system or a default one. |
<T> T |
pickWinMac(T windows,
T mac)
Picks one of the given values based on the
OS.Family of this operating system or throws an UnsupportedOSException if there is no value to represent it. |
<T> T |
pickWinMacAny(T windows,
T mac,
T anyOther)
Picks one of the given values based on the
OS.Family of this operating system or a default one. |
static OS |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static OS[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final OS WIN_95
public static final OS WIN_98
public static final OS WIN_XP
public static final OS WIN_VISTA
public static final OS WIN_7
public static final OS WIN_8
public static final OS WIN_8_1
public static final OS WIN_10
public static final OS WIN_UNKNOWN
public static final OS MAC_OSX_CHEETAH
public static final OS MAC_OSX_PUMA
public static final OS MAC_OSX_JAGUAR
public static final OS MAC_OSX_PANTHER
public static final OS MAC_OSX_TIGER
public static final OS MAC_OSX_LEOPARD
public static final OS MAC_OSX_SNOW_LEOPARD
public static final OS MAC_OSX_LION
public static final OS MAC_OSX_MOUNTAIN_LION
public static final OS MAC_OSX_MAVERICKS
public static final OS MAC_OSX_YOSEMITE
public static final OS MAC_OSX_EL_CAPITAN
public static final OS MAC_OS_SIERRA
public static final OS MAC_OS_HIGH_SIERRA
public static final OS MAC_OS_MOJAVE
public static final OS MAC_OS_CATALINA
public static final OS MAC_OS_BIG_SUR
public static final OS MAC_UNKNOWN
public static final OS DEBIAN
public static final OS UBUNTU
public static final OS GENTOO
public static final OS LINUX_MINT
public static final OS RED_HAT_ENTERPRISE_LINUX
public static final OS CENTOS
public static final OS FEDORA
public static final OS ARCH_LINUX
public static final OS SUSE
public static final OS LINUX_UNKNOWN
public static final OS SOLARIS
public static final OS UNKNOWN
public static OS[] values()
for (OS c : OS.values()) System.out.println(c);
public static OS 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 OS current()
public <T> T pick(T windows, T mac, T linux, T other)
OS.Family
of this operating system.T
- The type of the value.windows
- The value if the OS family is OS.Family.WINDOWS
.mac
- The value if the OS family is OS.Family.MAC
.linux
- The value if the OS family is OS.Family.LINUX
.other
- The value if the OS family is OS.Family.OTHER
.public <T> T pick(T windows, T mac, T linux)
OS.Family
of this operating system or throws an UnsupportedOSException
if there is no value to represent it.T
- The type of the value.windows
- The value if the OS family is OS.Family.WINDOWS
.mac
- The value if the OS family is OS.Family.MAC
.linux
- The value if the OS family is OS.Family.LINUX
.UnsupportedOSException
- If this operating system is none of the above mentioned options.public <T> T pickWinMacAny(T windows, T mac, T anyOther)
OS.Family
of this operating system or a default one.T
- The type of the value.windows
- The value if the OS family is OS.Family.WINDOWS
.mac
- The value if the OS family is OS.Family.MAC
.anyOther
- The value if the OS is neither Windows or Mac.public <T> T pickWinMac(T windows, T mac)
OS.Family
of this operating system or throws an UnsupportedOSException
if there is no value to represent it.T
- The type of the value.windows
- The value if the OS family is OS.Family.WINDOWS
.mac
- The value if the OS family is OS.Family.MAC
.UnsupportedOSException
- If this operating system is none of the above mentioned options.public <T> T pickWinLinuxAny(T windows, T linux, T anyOther)
OS.Family
of this operating system or a default one.T
- The type of the value.windows
- The value if the OS family is OS.Family.WINDOWS
.linux
- The value if the OS family is OS.Family.LINUX
.anyOther
- The value if the OS is neither Windows or Linux.public <T> T pickWinLinux(T windows, T linux)
OS.Family
of this operating system or throws an UnsupportedOSException
if there is no value to represent it.T
- The type of the value.windows
- The value if the OS family is OS.Family.WINDOWS
.linux
- The value if the OS family is OS.Family.LINUX
.UnsupportedOSException
- If this operating system is none of the above mentioned options.public <T> T pickMacLinuxAny(T mac, T linux, T anyOther)
OS.Family
of this operating system or a default one.T
- The type of the value.mac
- The value if the OS family is OS.Family.MAC
.linux
- The value if the OS family is OS.Family.LINUX
.anyOther
- The value if the OS is neither Mac or Linux.public <T> T pickMacLinux(T mac, T linux)
OS.Family
of this operating system or throws an UnsupportedOSException
if there is no value to represent it.T
- The type of the value.mac
- The value if the OS family is OS.Family.MAC
.linux
- The value if the OS family is OS.Family.LINUX
.UnsupportedOSException
- If this operating system is none of the above mentioned options.public <T> T pickWindowsAny(T windows, T anyOther)
OS.Family
of this operating system is Windows, or a default one.T
- The type of the value.windows
- The value if the OS family is OS.Family.WINDOWS
.anyOther
- The value if the OS is anything other than Windows.public <T> T pickWindows(T windows)
OS.Family
of this OS is Windows or else throws an UnsupportedOSException
.T
- The type of the value.windows
- The value if the OS family is OS.Family.WINDOWS
.UnsupportedOSException
- If this operating system is not Windows.public <T> T pickMacAny(T mac, T anyOther)
OS.Family
of this operating system is Mac, or a default one.T
- The type of the value.mac
- The value if the OS family is OS.Family.MAC
.anyOther
- The value if the OS is anything other than Mac.public <T> T pickMac(T mac)
OS.Family
of this OS is Mac or else throws an UnsupportedOSException
.T
- The type of the value.mac
- The value if the OS family is OS.Family.MAC
.UnsupportedOSException
- If this operating system is not Mac.public <T> T pickLinuxAny(T linux, T anyOther)
OS.Family
of this operating system is Linux, or a default one.T
- The type of the value.linux
- The value if the OS family is OS.Family.LINUX
.anyOther
- The value if the OS is anything other than Linux.public <T> T pickLinux(T linux)
OS.Family
of this OS is Linux or else throws an UnsupportedOSException
.T
- The type of the value.linux
- The value if the OS family is OS.Family.LINUX
.UnsupportedOSException
- If this operating system is not Linux.public boolean isFamily(OS.Family... families)
families
- An array of families this OS's family has to be part of.public void enforceNotFamily(OS.Family... families)
UnsupportedOSException
if this OS's family is part of the given families.families
- An array of families that this OS's family is not allowed to be part of.UnsupportedOSException
- If the this operating system's family is part of the given array.public void enforceFamily(OS.Family... families)
UnsupportedOSException
if this OS is not part of the given families.families
- An array of families that this OS's family has to be part of.UnsupportedOSException
- If this operating system's family is not part of the given array.public boolean is(OS... operatingSystems)
operatingSystems
- An array of operating systems this OS has to be part of.public void enforceNot(OS... operatingSystems)
UnsupportedOSException
if this operating system is part of the given array.operatingSystems
- An array of operating systems that this OS is not allowed to be part of.UnsupportedOSException
- If this operating system is part of the given array.public void enforce(OS... operatingSystems)
UnsupportedOSException
if this operating system is not part of the given array.operatingSystems
- An array of operating systems that this OS has to be part of.UnsupportedOSException
- If this operating system is not part of the given array.public OS.Family getFamily()
Copyright © 2021. All rights reserved.