Enum Class OSFamily
- All Implemented Interfaces:
Serializable,Comparable<OSFamily>,Constable
Enum representing various families of operating systems.
It provides utilities for determining the current operating system
and parsing a string representation of an operating system name into
an
OSFamily instance.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionRepresents the AIX operating system family.Represents the FreeBSD operating system family.Represents the Linux operating system family.Represents the macOS family of operating systems.Represents the QNX operating system family.Enumeration constant representing the Solaris operating system.Represents the Microsoft Windows family of operating systems. -
Method Summary
Modifier and TypeMethodDescriptionstatic OSFamilycurrent()Determines the current operating system based on the system property "os.name".static OSFamilyParses the provided operating system name into anOSFamilyinstance.toString()Returns the name of this enum constant converted to lowercase.static OSFamilyReturns the enum constant of this class with the specified name.static OSFamily[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
AIX
Represents the AIX operating system family. -
FREE_BSD
Represents the FreeBSD operating system family. -
LINUX
Represents the Linux operating system family. -
MACOS
Represents the macOS family of operating systems. -
QNX
Represents the QNX operating system family. -
SOLARIS
Enumeration constant representing the Solaris operating system. -
WINDOWS
Represents the Microsoft Windows family of operating systems.
-
-
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
-
toString
Returns the name of this enum constant converted to lowercase. -
current
Determines the current operating system based on the system property "os.name".- Returns:
- the
OSFamilycorresponding to the current operating system. - Throws:
IllegalStateException- if the operating system is unknown or unrecognized.
-
parse
Parses the provided operating system name into anOSFamilyinstance.This method matches the given operating system name against predefined patterns to determine its corresponding
OSFamily.- Parameters:
osName- the name of the operating system, typically obtained from system properties or other sources, e.g., "os.name". It is case-insensitive.- Returns:
- the matching
OSFamilyinstance for the given operating system name - Throws:
IllegalStateException- if the operating system name does not match any knownOSFamily
-