Package com.helger.commons.system
Enum EOperatingSystem
- java.lang.Object
-
- java.lang.Enum<EOperatingSystem>
-
- com.helger.commons.system.EOperatingSystem
-
- All Implemented Interfaces:
IHasDisplayName,Serializable,Comparable<EOperatingSystem>
public enum EOperatingSystem extends Enum<EOperatingSystem> implements IHasDisplayName
This enumeration is used to determine the currently running Operating system.- Author:
- Philip Helger
-
-
Enum Constant Summary
Enum Constants Enum Constant Description AIXThe value indicating the AIX operating system.FREEBSDThe value indicating the FreeBSD operating system.HPUXThe value indicating the HP-UX operating system.LINUXThe value indicating the Linux operating system.MACOSThe value indicating the Mac OS X operating system.SOLARISThe value indicating the Solaris operating system.UNKNOWNThe value indicating an unknown operating system.WINDOWSThe value indicating the Windows operating system.ZOSThe value indicating the z/OS operating system.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EOperatingSystemforName(String sOSName)Retrieves the operating system for the provided name.static EOperatingSystemgetCurrentOS()static StringgetCurrentOSName()static StringgetCurrentOSVersion()StringgetDisplayName()ENewLineModegetNewLineMode()booleanisCurrentOS()booleanisMacOSBased()Indicates whether the provided operating system is MacOS-based.booleanisUnixBased()Indicates whether the provided operating system is UNIX-based.booleanisWindowsBased()Indicates whether the provided operating system is Windows-based.static EOperatingSystemvalueOf(String name)Returns the enum constant of this type with the specified name.static EOperatingSystem[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
AIX
public static final EOperatingSystem AIX
The value indicating the AIX operating system.
-
FREEBSD
public static final EOperatingSystem FREEBSD
The value indicating the FreeBSD operating system.
-
HPUX
public static final EOperatingSystem HPUX
The value indicating the HP-UX operating system.
-
LINUX
public static final EOperatingSystem LINUX
The value indicating the Linux operating system.
-
MACOS
public static final EOperatingSystem MACOS
The value indicating the Mac OS X operating system.
-
SOLARIS
public static final EOperatingSystem SOLARIS
The value indicating the Solaris operating system.
-
WINDOWS
public static final EOperatingSystem WINDOWS
The value indicating the Windows operating system.
-
ZOS
public static final EOperatingSystem ZOS
The value indicating the z/OS operating system.
-
UNKNOWN
public static final EOperatingSystem UNKNOWN
The value indicating an unknown operating system.
-
-
Method Detail
-
values
public static EOperatingSystem[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (EOperatingSystem c : EOperatingSystem.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static EOperatingSystem valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException- if the argument is null
-
getDisplayName
@Nonnull @Nonempty public String getDisplayName()
- Specified by:
getDisplayNamein interfaceIHasDisplayName- Returns:
- The display name of this object. Should never be
null.
-
isUnixBased
public boolean isUnixBased()
Indicates whether the provided operating system is UNIX-based. UNIX-based operating systems include:- AIX
- FreeBSD
- HP-UX
- Linux
- Mac OS X
- Solaris
- Returns:
trueif the provided operating system is UNIX-based, orfalseif not.
-
isWindowsBased
public boolean isWindowsBased()
Indicates whether the provided operating system is Windows-based. Windows-based operating systems include:- Windows
- Returns:
trueif the provided operating system is Windows-based, orfalseif not.
-
isMacOSBased
public boolean isMacOSBased()
Indicates whether the provided operating system is MacOS-based. MacOS-based operating systems include:- MacOS
- Returns:
trueif the provided operating system is MacOS-based, orfalseif not.
-
isCurrentOS
public boolean isCurrentOS()
- Returns:
trueif the this OS is the current OS.
-
getNewLineMode
@Nonnull public ENewLineMode getNewLineMode()
- Returns:
- The newline mode matching this operating system.
-
forName
@Nonnull public static EOperatingSystem forName(@Nullable String sOSName)
Retrieves the operating system for the provided name. The name provided should come from theos.namesystem property.- Parameters:
sOSName- The name for which to retrieve the corresponding operating system.- Returns:
- The operating system for the provided name. If the operating system
could not be determined,
UNKNOWNis returned and nevernull.
-
getCurrentOS
@Nonnull public static EOperatingSystem getCurrentOS()
- Returns:
- The current OS. Never
null.
-
getCurrentOSName
@Nullable public static String getCurrentOSName()
- Returns:
- The name of the current operating system.
-
-