org.apache.tools.ant.taskdefs.condition

Class Os

public class Os extends Object implements Condition

Condition that tests the OS type.

Since: Ant 1.4

Field Summary
static StringFAMILY_9X
OS family that can be tested for.
static StringFAMILY_DOS
OS family that can be tested for.
static StringFAMILY_MAC
OS family that can be tested for.
static StringFAMILY_NETWARE
OS family that can be tested for.
static StringFAMILY_NT
OS family that can be tested for.
static StringFAMILY_OS2
OS family that can be tested for.
static StringFAMILY_OS400
OS family that can be tested for.
static StringFAMILY_TANDEM
OS family that can be tested for.
static StringFAMILY_UNIX
OS family that can be tested for.
static StringFAMILY_VMS
OS family that can be tested for.
static StringFAMILY_WINDOWS
OS family that can be tested for.
static StringFAMILY_ZOS
OS family that can be tested for.
Constructor Summary
Os()
Default constructor
Os(String family)
Constructor that sets the family attribute
Method Summary
booleaneval()
Determines if the OS on which Ant is executing matches the type of that set in setFamily.
static booleanisArch(String arch)
Determines if the OS on which Ant is executing matches the given OS architecture.
static booleanisFamily(String family)
Determines if the OS on which Ant is executing matches the given OS family.
static booleanisName(String name)
Determines if the OS on which Ant is executing matches the given OS name.
static booleanisOs(String family, String name, String arch, String version)
Determines if the OS on which Ant is executing matches the given OS family, name, architecture and version
static booleanisVersion(String version)
Determines if the OS on which Ant is executing matches the given OS version.
voidsetArch(String arch)
Sets the desired OS architecture
voidsetFamily(String f)
Sets the desired OS family type
voidsetName(String name)
Sets the desired OS name
voidsetVersion(String version)
Sets the desired OS version

Field Detail

FAMILY_9X

public static final String FAMILY_9X
OS family that can be tested for. {@value }

FAMILY_DOS

public static final String FAMILY_DOS
OS family that can be tested for. {@value }

FAMILY_MAC

public static final String FAMILY_MAC
OS family that can be tested for. {@value }

FAMILY_NETWARE

public static final String FAMILY_NETWARE
OS family that can be tested for. {@value }

FAMILY_NT

public static final String FAMILY_NT
OS family that can be tested for. {@value }

FAMILY_OS2

public static final String FAMILY_OS2
OS family that can be tested for. {@value }

FAMILY_OS400

public static final String FAMILY_OS400
OS family that can be tested for. {@value }

FAMILY_TANDEM

public static final String FAMILY_TANDEM
OS family that can be tested for. {@value }

FAMILY_UNIX

public static final String FAMILY_UNIX
OS family that can be tested for. {@value }

FAMILY_VMS

public static final String FAMILY_VMS
OS family that can be tested for. {@value }

FAMILY_WINDOWS

public static final String FAMILY_WINDOWS
OS family that can be tested for. {@value }

FAMILY_ZOS

public static final String FAMILY_ZOS
OS family that can be tested for. {@value }

Constructor Detail

Os

public Os()
Default constructor

Os

public Os(String family)
Constructor that sets the family attribute

Parameters: family a String value

Method Detail

eval

public boolean eval()
Determines if the OS on which Ant is executing matches the type of that set in setFamily.

Returns: true if the os matches.

Throws: BuildException if there is an error.

See Also: setFamily

isArch

public static boolean isArch(String arch)
Determines if the OS on which Ant is executing matches the given OS architecture.

Parameters: arch the OS architecture to check for

Returns: true if the OS matches

Since: 1.7

isFamily

public static boolean isFamily(String family)
Determines if the OS on which Ant is executing matches the given OS family.

Parameters: family the family to check for

Returns: true if the OS matches

Since: 1.5

isName

public static boolean isName(String name)
Determines if the OS on which Ant is executing matches the given OS name.

Parameters: name the OS name to check for

Returns: true if the OS matches

Since: 1.7

isOs

public static boolean isOs(String family, String name, String arch, String version)
Determines if the OS on which Ant is executing matches the given OS family, name, architecture and version

Parameters: family The OS family name The OS name arch The OS architecture version The OS version

Returns: true if the OS matches

Since: 1.7

isVersion

public static boolean isVersion(String version)
Determines if the OS on which Ant is executing matches the given OS version.

Parameters: version the OS version to check for

Returns: true if the OS matches

Since: 1.7

setArch

public void setArch(String arch)
Sets the desired OS architecture

Parameters: arch The OS architecture

setFamily

public void setFamily(String f)
Sets the desired OS family type

Parameters: f The OS family type desired
Possible values:

setName

public void setName(String name)
Sets the desired OS name

Parameters: name The OS name

setVersion

public void setVersion(String version)
Sets the desired OS version

Parameters: version The OS version