Class Tstamp

All Implemented Interfaces:
Cloneable

public class Tstamp extends Task
Sets properties to the current time, or offsets from the current time. The default properties are TSTAMP, DSTAMP and TODAY;
Since:
Ant 1.1
  • Constructor Details

    • Tstamp

      public Tstamp()
  • Method Details

    • setPrefix

      public void setPrefix(String prefix)
      Set a prefix for the properties. If the prefix does not end with a "." one is automatically added.
      Parameters:
      prefix - the prefix to use.
      Since:
      Ant 1.5
    • execute

      public void execute() throws BuildException
      create the timestamps. Custom ones are done before the standard ones, to get their retaliation in early.
      Overrides:
      execute in class Task
      Throws:
      BuildException - on error.
    • createFormat

      public Tstamp.CustomFormat createFormat()
      create a custom format with the current prefix.
      Returns:
      a ready to fill-in format
    • getNow

      protected Date getNow()
      Return the Date instance to use as base for DSTAMP, TSTAMP and TODAY.
      Returns:
      Date
    • getNow

      protected Optional<Date> getNow(String propertyName, Function<String,Date> map, BiFunction<String,String,String> log)
      Checks and returns a Date if the specified property is set.
      Parameters:
      propertyName - name of the property to check
      map - conversion of the property value as string to Date
      log - supplier of the log message containing the property name and value if the conversion fails
      Returns:
      Optional containing the Date or null