org.apache.tools.ant.taskdefs

Class Tstamp.CustomFormat

Enclosing Class:
Tstamp

public class Tstamp.CustomFormat
extends java.lang.Object

This nested element that allows a property to be set to the current date and time in a given format. The date/time patterns are as defined in the Java SimpleDateFormat class. The format element also allows offsets to be applied to the time to generate different time values.

To do:
consider refactoring out into a re-usable element.

Constructor Summary

CustomFormat()
Create a format

Method Summary

void
execute(Project project, Date date, Location location)
validate parameter and execute the format
void
setLocale(String locale)
The locale used to create date/time string.
void
setOffset(int offset)
The numeric offset to the current time.
void
setPattern(String pattern)
The date/time pattern to be used.
void
setProperty(String propertyName)
The property to receive the date/time string in the given pattern
void
setTimezone(String id)
The timezone to use for displaying time.
void
setUnit(String unit)
Deprecated. setUnit(String) is deprecated and is replaced with setUnit(Tstamp.Unit) to make Ant's Introspection mechanism do the work and also to encapsulate operations on the unit in its own class.
void
setUnit(Tstamp.Unit unit)
The unit of the offset to be applied to the current time.

Constructor Details

CustomFormat

public CustomFormat()
Create a format

Method Details

execute

public void execute(Project project,
                    Date date,
                    Location location)
validate parameter and execute the format

Parameters:
project - project to set property in
date - date to use as a starting point
location - line in file (for errors)


setLocale

public void setLocale(String locale)
The locale used to create date/time string. The general form is "language, country, variant" but either variant or variant and country may be omitted. For more information please refer to documentation for the java.util.Locale class.

Parameters:
locale -

See Also:
java.util.Locale


setOffset

public void setOffset(int offset)
The numeric offset to the current time.

Parameters:
offset -


setPattern

public void setPattern(String pattern)
The date/time pattern to be used. The values are as defined by the Java SimpleDateFormat class.

Parameters:
pattern -

See Also:
java.text.SimpleDateFormat


setProperty

public void setProperty(String propertyName)
The property to receive the date/time string in the given pattern

Parameters:
propertyName -


setTimezone

public void setTimezone(String id)
The timezone to use for displaying time. The values are as defined by the Java TimeZone class.

Parameters:
id -

See Also:
java.util.TimeZone


setUnit

public void setUnit(String unit)

Deprecated. setUnit(String) is deprecated and is replaced with setUnit(Tstamp.Unit) to make Ant's Introspection mechanism do the work and also to encapsulate operations on the unit in its own class.


setUnit

public void setUnit(Tstamp.Unit unit)
The unit of the offset to be applied to the current time. Valid Values are
  • millisecond
  • second
  • minute
  • hour
  • day
  • week
  • month
  • year
The default unit is day.

Parameters:
unit -


Copyright B) 2000-2005 Apache Software Foundation. All Rights Reserved.