java.lang.Object
org.apache.tools.ant.taskdefs.condition.Os
All Implemented Interfaces:
Condition

public class Os extends Object implements Condition
Condition that tests the OS type.
Since:
Ant 1.4
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    OS family that can be tested for.
    static final String
    OS family that can be tested for.
    static final String
    OS family that can be tested for.
    static final String
    OS family that can be tested for.
    static final String
    OS family that can be tested for.
    static final String
    OS family that can be tested for.
    static final String
    OS family that can be tested for.
    static final String
    OS family that can be tested for.
    static final String
    OS family that can be tested for.
    static final String
    OS family that can be tested for.
    static final String
    OS family that can be tested for.
    static final String
    OS family that can be tested for.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Os()
    Default constructor
    Os(String family)
    Constructor that sets the family attribute
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Determines if the OS on which Ant is executing matches the type of that set in setFamily.
    static boolean
    isArch(String arch)
    Determines if the OS on which Ant is executing matches the given OS architecture.
    static boolean
    isFamily(String family)
    Determines if the OS on which Ant is executing matches the given OS family.
    static boolean
    isName(String name)
    Determines if the OS on which Ant is executing matches the given OS name.
    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
    static boolean
    isVersion(String version)
    Determines if the OS on which Ant is executing matches the given OS version.
    void
    Sets the desired OS architecture
    void
    Sets the desired OS family type
    void
    Sets the desired OS name
    void
    setVersion(String version)
    Sets the desired OS version

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • Os

      public Os()
      Default constructor
    • Os

      public Os(String family)
      Constructor that sets the family attribute
      Parameters:
      family - a String value
  • Method Details

    • setFamily

      public void setFamily(String f)
      Sets the desired OS family type
      Parameters:
      f - The OS family type desired

      Possible values:

      • dos
      • mac
      • netware
      • os/2
      • tandem
      • unix
      • windows
      • win9x
      • z/os
      • os/400
    • setName

      public void setName(String name)
      Sets the desired OS name
      Parameters:
      name - The OS name
    • setArch

      public void setArch(String arch)
      Sets the desired OS architecture
      Parameters:
      arch - The OS architecture
    • setVersion

      public void setVersion(String version)
      Sets the desired OS version
      Parameters:
      version - The OS version
    • eval

      public boolean eval() throws BuildException
      Determines if the OS on which Ant is executing matches the type of that set in setFamily.
      Specified by:
      eval in interface Condition
      Returns:
      true if the os matches.
      Throws:
      BuildException - if there is an error.
      See Also:
    • 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
    • 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
    • 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
    • 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