Class IsLastModified
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.taskdefs.condition.IsLastModified
Condition that makes assertions about the last modified date of a
resource.
- Since:
- Ant 1.8.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classdescribes comparison modes. -
Field Summary
Fields inherited from class ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThe resource to test.booleaneval()evaluate the conditionprotected longCalculate timestamp as millis either based on millis or dateTime (and pattern) attribute.voidsetDatetime(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".voidsetMillis(long millis) Set the new modification time of file(s) touched in milliseconds since midnight Jan 1 1970.voidThe type of comparison to test.voidsetPattern(String pattern) Set the format of the datetime attribute.protected voidvalidate()Argument validation.Methods inherited from class ProjectComponent
clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProjectModifier and TypeMethodDescriptionclone()Returns the description of the current action.Returns the file/location where this task was defined.Returns the project to which this component belongs.voidLogs a message with the default (INFO) priority.voidLogs a message with the given priority.voidsetDescription(String desc) Sets a description of the current action.voidsetLocation(Location location) Sets the file/location where this task was defined.voidsetProject(Project project) Sets the project object of this component.
-
Constructor Details
-
IsLastModified
public IsLastModified()
-
-
Method Details
-
setMillis
public void setMillis(long millis) Set the new modification time of file(s) touched in milliseconds since midnight Jan 1 1970.- Parameters:
millis- thelongtimestamp to use.
-
setDatetime
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- theStringdate in the specified format.
-
setPattern
Set the format of the datetime attribute.- Parameters:
pattern- theSimpleDateFormat-compatible format pattern.
-
add
-
setMode
The type of comparison to test.- Parameters:
mode- the mode of comparison.
-
validate
Argument validation.- Throws:
BuildException- if the required attributes are not supplied or if there is an inconsistency in the attributes.
-
getMillis
Calculate timestamp as millis either based on millis or dateTime (and pattern) attribute.- Returns:
- time in milliseconds
- Throws:
BuildException- if the date cannot be parsed.
-
eval
evaluate the condition- Specified by:
evalin interfaceCondition- Returns:
- true or false depending on the comparison mode and the time of the resource
- Throws:
BuildException- if something goes wrong
-