Class Date
java.lang.Object
org.apache.tools.ant.types.resources.selectors.Date
- All Implemented Interfaces:
ResourceSelector
Date ResourceSelector. Based on the date FileSelector, with the most
notable difference being the lack of support for the includedirs attribute.
It is recommended that the effect of includeDirs = "false" be achieved for
resources by enclosing a "dir" Type ResourceSelector and a Date
ResourceSelector in an Or ResourceSelector.
- Since:
- Ant 1.7
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet the date and time in String format.long
Get the timestamp granularity used by this ResourceSelector.long
Get the date/time in ms.Get the pattern for use with the datetime attribute.getWhen()
Get the comparison mode.boolean
Return true if this Resource is selected.void
Set the date and time as a String.void
setGranularity
(long g) Set the granularity to use for this ResourceSelector.void
setMillis
(long m) Set the date/time in milliseconds since 1970.void
setPattern
(String p) Set the optional pattern to use with the datetime attribute.void
Set the comparison mode.
-
Constructor Details
-
Date
public Date()
-
-
Method Details
-
setMillis
public void setMillis(long m) Set the date/time in milliseconds since 1970.- Parameters:
m
- the number of millis.
-
getMillis
public long getMillis()Get the date/time in ms.- Returns:
- long number of millis since 1970.
-
setDateTime
Set the date and time as a String.- Parameters:
s
- the date and time to use.
-
getDatetime
Get the date and time in String format.- Returns:
- a String representing a date and time.
-
setGranularity
public void setGranularity(long g) Set the granularity to use for this ResourceSelector.- Parameters:
g
- the timestamp granularity.
-
getGranularity
public long getGranularity()Get the timestamp granularity used by this ResourceSelector.- Returns:
- the long granularity.
-
setPattern
Set the optional pattern to use with the datetime attribute.- Parameters:
p
- the SimpleDateFormat-compatible pattern string.
-
getPattern
Get the pattern for use with the datetime attribute.- Returns:
- a SimpleDateFormat-compatible pattern string.
-
setWhen
Set the comparison mode.- Parameters:
c
- a TimeComparison object.
-
getWhen
Get the comparison mode.- Returns:
- a TimeComparison object.
-
isSelected
Return true if this Resource is selected.- Specified by:
isSelected
in interfaceResourceSelector
- Parameters:
r
- the Resource to check.- Returns:
- whether the Resource was selected.
-