Package com.diffplug.common.swt.os
Enum OS
- java.lang.Object
-
- java.lang.Enum<OS>
-
- com.diffplug.common.swt.os.OS
-
-
Enum Constant Summary
Enum Constants Enum Constant Description LINUX_unknownLINUX_x64LINUX_x86MAC_siliconMAC_unknownMAC_x64WIN_unknownWIN_x64WIN_x86
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringarch()SWT-style x86/x86_64static voiddetectPlatform(java.util.function.Function<java.lang.String,java.lang.String> systemProperty, java.util.function.Function<java.lang.String,java.lang.String> environmentVariable)Eagerly detects the native and running JVM properties.ArchgetArch()Returns the architecture of the given operating system.static OSgetNative()Returns the native OS: 32-bit JVM on 64-bit Windows returns OS.WIN_64.static OSgetRunning()Returns the running OS: 32-bit JVM on 64-bit Windows returns OS.WIN_32.booleanisLinux()booleanisMac()booleanisMacOrLinux()booleanisWindows()static voidmain(java.lang.String[] args)java.lang.Stringos()SWT-style win32/linux/macosxjava.lang.StringosDotArch()os().arch()java.lang.StringtoSwt()windowing.os.archstatic java.lang.UnsupportedOperationExceptionunsupportedException(OS os)Returns an UnsupportedOperationException for the given OS.static OSvalueOf(java.lang.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.<T> TwinMacLinux(T win, T mac, T linux)Returns the appropriate value depending on the OS.
-
-
-
Enum Constant Detail
-
WIN_x64
public static final OS WIN_x64
-
WIN_x86
public static final OS WIN_x86
-
LINUX_x64
public static final OS LINUX_x64
-
LINUX_x86
public static final OS LINUX_x86
-
MAC_x64
public static final OS MAC_x64
-
MAC_silicon
public static final OS MAC_silicon
-
WIN_unknown
public static final OS WIN_unknown
-
LINUX_unknown
public static final OS LINUX_unknown
-
MAC_unknown
public static final OS MAC_unknown
-
-
Method Detail
-
values
public static OS[] 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 (OS c : OS.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static OS valueOf(java.lang.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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
isWindows
public boolean isWindows()
-
isLinux
public boolean isLinux()
-
isMac
public boolean isMac()
-
isMacOrLinux
public boolean isMacOrLinux()
-
winMacLinux
public <T> T winMacLinux(T win, T mac, T linux)Returns the appropriate value depending on the OS.
-
getArch
public Arch getArch()
Returns the architecture of the given operating system.
-
os
public java.lang.String os()
SWT-style win32/linux/macosx
-
arch
public java.lang.String arch()
SWT-style x86/x86_64
-
osDotArch
public java.lang.String osDotArch()
os().arch()
-
toSwt
public java.lang.String toSwt()
windowing.os.arch
-
getNative
public static OS getNative()
Returns the native OS: 32-bit JVM on 64-bit Windows returns OS.WIN_64.
-
getRunning
public static OS getRunning()
Returns the running OS: 32-bit JVM on 64-bit Windows returns OS.WIN_32.
-
detectPlatform
public static void detectPlatform(java.util.function.Function<java.lang.String,java.lang.String> systemProperty, java.util.function.Function<java.lang.String,java.lang.String> environmentVariable)Eagerly detects the native and running JVM properties.
-
unsupportedException
public static java.lang.UnsupportedOperationException unsupportedException(OS os)
Returns an UnsupportedOperationException for the given OS.
-
main
public static void main(java.lang.String[] args)
-
-