public class Os
extends java.lang.Object
NOTE: This class was copied from plexus-utils, to allow this library to stand completely self-contained.
Condition that tests the OS type.
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
FAMILY_DOS |
|
static java.lang.String |
FAMILY_MAC |
|
static java.lang.String |
FAMILY_NETWARE |
|
static java.lang.String |
FAMILY_OPENVMS |
|
static java.lang.String |
FAMILY_OS2 |
|
static java.lang.String |
FAMILY_OS400 |
|
static java.lang.String |
FAMILY_TANDEM |
|
static java.lang.String |
FAMILY_UNIX |
|
static java.lang.String |
FAMILY_WIN9X |
|
static java.lang.String |
FAMILY_WINDOWS |
|
static java.lang.String |
FAMILY_ZOS |
|
static java.lang.String |
OS_ARCH |
|
static java.lang.String |
OS_FAMILY |
|
static java.lang.String |
OS_NAME |
|
static java.lang.String |
OS_VERSION |
Constructor | Description |
---|---|
Os() |
Default constructor
|
Os(java.lang.String family) |
Constructor that sets the family attribute
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
eval() |
Determines if the current OS matches the type of that
set in setFamily.
|
static java.util.Set<java.lang.String> |
getValidFamilies() |
|
static boolean |
isArch(java.lang.String arch) |
Determines if the current OS matches the given OS
architecture.
|
static boolean |
isFamily(java.lang.String family) |
Determines if the current OS matches the given OS
family.
|
static boolean |
isName(java.lang.String name) |
Determines if the current OS matches the given OS
name.
|
static boolean |
isOs(java.lang.String family,
java.lang.String name,
java.lang.String arch,
java.lang.String version) |
Determines if the current OS matches the given OS
family, name, architecture and version.
|
static boolean |
isValidFamily(java.lang.String theFamily) |
Helper method to check if the given family is in the
following list:
dos
mac
netware
os/2
tandem
unix
windows
win9x
z/os
os/400
openvms
|
static boolean |
isVersion(java.lang.String version) |
Determines if the current OS matches the given OS
version.
|
void |
setArch(java.lang.String arch) |
Sets the desired OS architecture
|
void |
setFamily(java.lang.String f) |
Sets the desired OS family type
|
void |
setName(java.lang.String name) |
Sets the desired OS name
|
void |
setVersion(java.lang.String version) |
Sets the desired OS version
|
public static final java.lang.String FAMILY_DOS
public static final java.lang.String FAMILY_MAC
public static final java.lang.String FAMILY_NETWARE
public static final java.lang.String FAMILY_OS2
public static final java.lang.String FAMILY_TANDEM
public static final java.lang.String FAMILY_UNIX
public static final java.lang.String FAMILY_WINDOWS
public static final java.lang.String FAMILY_WIN9X
public static final java.lang.String FAMILY_ZOS
public static final java.lang.String FAMILY_OS400
public static final java.lang.String FAMILY_OPENVMS
public static final java.lang.String OS_NAME
public static final java.lang.String OS_ARCH
public static final java.lang.String OS_VERSION
public static final java.lang.String OS_FAMILY
public Os()
public Os(java.lang.String family)
family
- a String valuepublic void setFamily(java.lang.String f)
f
- The OS family type desired
Possible values:
public void setName(java.lang.String name)
name
- The OS namepublic void setArch(java.lang.String arch)
arch
- The OS architecturepublic void setVersion(java.lang.String version)
version
- The OS versionpublic boolean eval() throws java.lang.Exception
java.lang.Exception
- in case of an error.setFamily(String)
public static boolean isFamily(java.lang.String family)
family
- the family to check forpublic static boolean isName(java.lang.String name)
name
- the OS name to check forpublic static boolean isArch(java.lang.String arch)
arch
- the OS architecture to check forpublic static boolean isVersion(java.lang.String version)
version
- the OS version to check forpublic static boolean isOs(java.lang.String family, java.lang.String name, java.lang.String arch, java.lang.String version)
family
- The OS familyname
- The OS namearch
- The OS architectureversion
- The OS versionpublic static boolean isValidFamily(java.lang.String theFamily)
theFamily
- the family to check.public static java.util.Set<java.lang.String> getValidFamilies()
Copyright © 2018. All rights reserved.