Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs

public Class UpToDate

extends Task
implements Condition
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.taskdefs.condition.Condition
Imports
java.io.File, java.util.List, .Vector, org.apache.tools.ant.BuildException, .Project, .Task, org.apache.tools.ant.taskdefs.condition.Condition, org.apache.tools.ant.types.FileSet, .Mapper, .Resource, org.apache.tools.ant.types.resources.Union, org.apache.tools.ant.util.FileNameMapper, .MergingMapper, .ResourceUtils, .SourceFileScanner

Sets the given property if the specified target has a timestamp greater than all of the source files.
Since
Ant 1.2

Field Summary

Modifier and TypeField and Description
protected Mapper
private String
private File
private List<FileSet>
private Union
private File
private String
Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
add(FileNameMapper
the mapper to add
fileNameMapper
)

A nested filenamemapper

public void
addSrcfiles(final FileSet
the source files
fs
)

Nested <srcfiles> element.

public Mapper

Returns:

a mapper to be configured
createMapper
()

Defines the FileNameMapper to use (nested mapper element).

public Union

Returns:

the source resources to configure.
createSrcResources
()

Nested resource collections as sources.

public boolean

Returns:

true if the target(s) is/are up-to-date
eval
()

Implements org.apache.tools.ant.taskdefs.condition.Condition.eval.

Evaluate (all) target and source file(s) to see if the target(s) is/are up-to-date.
public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Sets property to true if target file(s) have a more recent timestamp than (each of) the corresponding source file(s).
private FileNameMapper
private String
getValue()

Returns the value, or "true" if a specific value wasn't provided.

protected boolean

Returns:

true if the files are up to date
scanDir
(File
the directory
srcDir
,
String[]
the files to scan for
files
)

Scan a directory for files to check for "up to date"ness

public void
setProperty(final String
the name of the property to set if Target is up-to-date.
property
)

The property to set if the target file is more up-to-date than (each of) the source file(s).

public void
setSrcfile(final File
the file we are checking against the target file.
file
)

The file that must be older than the target file if the property is to be set.

public void
setTargetFile(final File
the file we are checking against.
file
)

The file which must be more up-to-date than (each of) the source file(s) if the property is to be set.

public void
setValue(final String
the value to set the property to if Target is up-to-date
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).

Inherited from org.apache.tools.ant.Task:
bindToOwnergetOwningTargetgetRuntimeConfigurableWrappergetTaskNamegetTaskTypegetWrapperhandleErrorFlushhandleErrorOutputhandleFlushhandleInputhandleOutputinitisInvalidloglogloglogmaybeConfigureperformreconfiguresetOwningTargetsetRuntimeConfigurableWrappersetTaskNamesetTaskType

Field Detail

mapperElementback to summary
protected Mapper mapperElement
propertyback to summary
private String property
sourceFileback to summary
private File sourceFile
sourceFileSetsback to summary
private List<FileSet> sourceFileSets
sourceResourcesback to summary
private Union sourceResources
targetFileback to summary
private File targetFile
valueback to summary
private String value

Constructor Detail

UpToDateback to summary
public UpToDate()

Method Detail

addback to summary
public void add(FileNameMapper fileNameMapper)

A nested filenamemapper

Parameters
fileNameMapper:FileNameMapper

the mapper to add

Since
Ant 1.6.3
addSrcfilesback to summary
public void addSrcfiles(final FileSet fs)

Nested <srcfiles> element.

Parameters
fs:FileSet

the source files

createMapperback to summary
public Mapper createMapper() throws BuildException

Defines the FileNameMapper to use (nested mapper element).

Returns:Mapper

a mapper to be configured

Exceptions
BuildException:
if more than one mapper is defined
createSrcResourcesback to summary
public Union createSrcResources()

Nested resource collections as sources.

Returns:Union

the source resources to configure.

Since
Ant 1.7
evalback to summary
public boolean eval()

Implements org.apache.tools.ant.taskdefs.condition.Condition.eval.

Evaluate (all) target and source file(s) to see if the target(s) is/are up-to-date.

Returns:boolean

true if the target(s) is/are up-to-date

Annotations
@Override
executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

Sets property to true if target file(s) have a more recent timestamp than (each of) the corresponding source file(s).

Annotations
@Override
Exceptions
BuildException:
on error
getMapperback to summary
private FileNameMapper getMapper()
getValueback to summary
private String getValue()

Returns the value, or "true" if a specific value wasn't provided.

scanDirback to summary
protected boolean scanDir(File srcDir, String[] files)

Scan a directory for files to check for "up to date"ness

Parameters
srcDir:File

the directory

files:String[]

the files to scan for

Returns:boolean

true if the files are up to date

setPropertyback to summary
public void setProperty(final String property)

The property to set if the target file is more up-to-date than (each of) the source file(s).

Parameters
property:String

the name of the property to set if Target is up-to-date.

setSrcfileback to summary
public void setSrcfile(final File file)

The file that must be older than the target file if the property is to be set.

Parameters
file:File

the file we are checking against the target file.

setTargetFileback to summary
public void setTargetFile(final 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:File

the file we are checking against.

setValueback to summary
public void setValue(final 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:String

the value to set the property to if Target is up-to-date