Package org.apache.tools.ant.taskdefs

# Class UpToDate

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.UpToDate

All Implemented Interfaces:
  `Cloneable`, `Condition`

public class UpToDate extends Task implements Condition
Sets the given property if the specified target has a timestamp greater than all of the source files.

Since:
  Ant 1.2

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Mapper`
  `mapperElement`

  ### Fields inherited from class org.apache.tools.ant.Task

  `target, taskName, taskType, wrapper`

  ### Fields inherited from class org.apache.tools.ant.ProjectComponent

  `description, location, project`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UpToDate()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `add(FileNameMapper fileNameMapper)`
  A nested filenamemapper
  `void`
  `addSrcfiles(FileSet fs)`
  Nested <srcfiles> element.
  `Mapper`
  `createMapper()`
  Defines the FileNameMapper to use (nested mapper element).
  `Union`
  `createSrcResources()`
  Nested resource collections as sources.
  `boolean`
  `eval()`
  Evaluate (all) target and source file(s) to see if the target(s) is/are up-to-date.
  `void`
  `execute()`
  Sets property to true if target file(s) have a more recent timestamp than (each of) the corresponding source file(s).
  `protected boolean`
  `scanDir(File srcDir, String[] files)`
  Scan a directory for files to check for "up to date"ness
  `void`
  `setProperty(String property)`
  The property to set if the target file is more up-to-date than (each of) the source file(s).
  `void`
  `setSrcfile(File file)`
  The file that must be older than the target file if the property is to be set.
  `void`
  `setTargetFile(File file)`
  The file which must be more up-to-date than (each of) the source file(s) if the property is to be set.
  `void`
  `setValue(String value)`
  The value to set the named property to if the target file is more up-to-date than (each of) the source file(s).

  ### Methods inherited from class org.apache.tools.ant.Task

  `bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType`

  ### Methods inherited from class org.apache.tools.ant.ProjectComponent

  `clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject`

  ### Methods inherited from class java.lang.Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### mapperElement

    protected Mapper mapperElement

- ## Constructor Details

  - ### UpToDate

    public UpToDate()

- ## Method Details

  - ### setProperty

    public void setProperty(String property)
    The property to set if the target file is more up-to-date than (each of) the source file(s).
    Parameters:
      `property` - the name of the property to set if Target is up-to-date.

  - ### setValue

    public void setValue(String value)
    The value to set the named property to if the target file is more up-to-date than (each of) the source file(s). Defaults to 'true'.
    Parameters:
      `value` - the value to set the property to if Target is up-to-date

  - ### setTargetFile

    public void setTargetFile(File file)
    The file which must be more up-to-date than (each of) the source file(s) if the property is to be set.
    Parameters:
      `file` - the file we are checking against.

  - ### setSrcfile

    public void setSrcfile(File file)
    The file that must be older than the target file if the property is to be set.
    Parameters:
      `file` - the file we are checking against the target file.

  - ### addSrcfiles

    public void addSrcfiles(FileSet fs)
    Nested <srcfiles> element.
    Parameters:
      `fs` - the source files

  - ### createSrcResources

    public Union createSrcResources()
    Nested resource collections as sources.
    Returns:
      the source resources to configure.
    Since:
      Ant 1.7

  - ### createMapper

    public Mapper createMapper() throws BuildException
    Defines the FileNameMapper to use (nested mapper element).
    Returns:
      a mapper to be configured
    Throws:
      `BuildException` - if more than one mapper is defined

  - ### add

    public void add(FileNameMapper fileNameMapper)
    A nested filenamemapper
    Parameters:
      `fileNameMapper` - the mapper to add
    Since:
      Ant 1.6.3

  - ### eval

    public boolean eval()
    Evaluate (all) target and source file(s) to see if the target(s) is/are up-to-date.
    Specified by:
      `eval` in interface `Condition`
    Returns:
      true if the target(s) is/are up-to-date

  - ### execute

    public void execute() throws BuildException
    Sets property to true if target file(s) have a more recent timestamp than (each of) the corresponding source file(s).
    Overrides:
      `execute` in class `Task`
    Throws:
      `BuildException` - on error

  - ### scanDir

    protected boolean scanDir(File srcDir, String[] files)
    Scan a directory for files to check for "up to date"ness
    Parameters:
      `srcDir` - the directory
      `files` - the files to scan for
    Returns:
      true if the files are up to date