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

public Class IsLastModified

extends ProjectComponent
implements Condition
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.taskdefs.condition.Condition
Imports
java.text.DateFormat, .ParseException, .SimpleDateFormat, java.util.Date, org.apache.tools.ant.BuildException, .Project, .ProjectComponent, org.apache.tools.ant.taskdefs.Touch, org.apache.tools.ant.types.EnumeratedAttribute, .Resource

Condition that makes assertions about the last modified date of a resource.
Since
Ant 1.8.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
IsLastModified.CompareMode

describes comparison modes.

Field Summary

Modifier and TypeField and Description
private String
private Touch.DateFormatFactory
private long
private IsLastModified.CompareMode
private Resource
Inherited from org.apache.tools.ant.ProjectComponent:
descriptionlocationproject

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
add(Resource
the resource to test
r
)

The resource to test.

public boolean

Returns:

true or false depending on the comparison mode and the time of the resource
eval
()

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

evaluate the condition
protected long

Returns:

time in milliseconds
getMillis
()

Calculate timestamp as millis either based on millis or dateTime (and pattern) attribute.

public void
setDatetime(String
the String date in the specified format.
dateTime
)

Set the new modification time of file(s) touched in the format "MM/DD/YYYY HH:MM AM or PM" or "MM/DD/YYYY HH:MM:SS AM or PM".

public void
setMillis(long
the long timestamp to use.
millis
)

Set the new modification time of file(s) touched in milliseconds since midnight Jan 1 1970.

public void
setMode(IsLastModified.CompareMode
the mode of comparison.
mode
)

The type of comparison to test.

public void
setPattern(final String
the SimpleDateFormat-compatible format pattern.
pattern
)

Set the format of the datetime attribute.

protected void
validate()

Argument validation.

Inherited from org.apache.tools.ant.ProjectComponent:
clonegetDescriptiongetLocationgetProjectloglogsetDescriptionsetLocationsetProject

Field Detail

dateTimeback to summary
private String dateTime
dfFactoryback to summary
private Touch.DateFormatFactory dfFactory
millisback to summary
private long millis
modeback to summary
private IsLastModified.CompareMode mode
resourceback to summary
private Resource resource

Constructor Detail

IsLastModifiedback to summary
public IsLastModified()

Method Detail

addback to summary
public void add(Resource r)

The resource to test.

Parameters
r:Resource

the resource to test

evalback to summary
public boolean eval() throws BuildException

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

evaluate the condition

Returns:boolean

true or false depending on the comparison mode and the time of the resource

Annotations
@Override
Exceptions
BuildException:
if something goes wrong
getMillisback to summary
protected long getMillis() throws BuildException

Calculate timestamp as millis either based on millis or dateTime (and pattern) attribute.

Returns:long

time in milliseconds

Exceptions
BuildException:
if the date cannot be parsed.
setDatetimeback to summary
public void setDatetime(String dateTime)

Set the new modification time of file(s) touched in the format "MM/DD/YYYY HH:MM AM or PM" or "MM/DD/YYYY HH:MM:SS AM or PM".

Parameters
dateTime:String

the String date in the specified format.

setMillisback to summary
public void setMillis(long millis)

Set the new modification time of file(s) touched in milliseconds since midnight Jan 1 1970.

Parameters
millis:long

the long timestamp to use.

setModeback to summary
public void setMode(IsLastModified.CompareMode mode)

The type of comparison to test.

Parameters
mode:IsLastModified.CompareMode

the mode of comparison.

setPatternback to summary
public void setPattern(final String pattern)

Set the format of the datetime attribute.

Parameters
pattern:String

the SimpleDateFormat-compatible format pattern.

validateback to summary
protected void validate() throws BuildException

Argument validation.

Exceptions
BuildException:
if the required attributes are not supplied or if there is an inconsistency in the attributes.
org.apache.tools.ant.taskdefs.condition back to summary

public Class IsLastModified.CompareMode

extends EnumeratedAttribute
Class Inheritance

describes comparison modes.

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final IsLastModified.CompareMode
private static final String
private static final String
private static final String
Inherited from org.apache.tools.ant.types.EnumeratedAttribute:
value

Constructor Summary

AccessConstructor and Description
public
CompareMode()

creates a CompareMode instance of type equals

public
CompareMode(String
one of the authorized values for comparemode
s
)

creates a comparemode instance

Method Summary

Modifier and TypeMethod and Description
public String[]
getValues()

Implements abstract org.apache.tools.ant.types.EnumeratedAttribute.getValues.

This is the only method a subclass needs to implement..
Inherited from org.apache.tools.ant.types.EnumeratedAttribute:
containsValuegetIndexgetInstancegetValueindexOfValuesetValuetoString

Field Detail

AFTER_TEXTback to summary
private static final String AFTER_TEXT
BEFORE_TEXTback to summary
private static final String BEFORE_TEXT
EQUALSback to summary
private static final IsLastModified.CompareMode EQUALS
EQUALS_TEXTback to summary
private static final String EQUALS_TEXT
NOT_AFTER_TEXTback to summary
private static final String NOT_AFTER_TEXT
NOT_BEFORE_TEXTback to summary
private static final String NOT_BEFORE_TEXT

Constructor Detail

CompareModeback to summary
public CompareMode()

creates a CompareMode instance of type equals

CompareModeback to summary
public CompareMode(String s)

creates a comparemode instance

Parameters
s:String

one of the authorized values for comparemode

Method Detail

getValuesback to summary
public String[] getValues()

Implements abstract org.apache.tools.ant.types.EnumeratedAttribute.getValues.

Doc from org.apache.tools.ant.types.EnumeratedAttribute.getValues.

This is the only method a subclass needs to implement..

Returns:String[]

an array holding all possible values of the enumeration. The order of elements must be fixed so that indexOfValue(String) always return the same index for the same value.

Annotations
@Override