Class DateTokenReplacer

java.lang.Object
hec.gfx2d.text.DateTokenReplacer
All Implemented Interfaces:
TokenReplacer

public class DateTokenReplacer extends Object implements TokenReplacer
Token replacement class that takes a token and resolves to a date. The available tokens that this replaces are CURDATE Current Date, default returns the ddMMMyyyy format i.e. 10JAN2000 CURMON Current Month, default returns the 3 letter code for the current month CURDAY Current Day, default returns the numerical day of month CURYEAR Current Year, deafult returns the 4 number year CURTIME Current Time, default returns a 24 hour time The token format is as follows TOKEN[:format] where the TOKEN is one of the above listed tokens and the format is a java simple date format patter.
  • Constructor Details

    • DateTokenReplacer

      public DateTokenReplacer()
  • Method Details

    • resolveToken

      public String resolveToken(String token, Object... args)
      Description copied from interface: TokenReplacer
      Resolves the token into a string that can be replaced by the TextSubstitution Manager or null if the Token cannot be resoved
      Specified by:
      resolveToken in interface TokenReplacer
      Parameters:
      token - the token to be replaced
      args - the arguments that are needed for the replacer to resolve the token
      Returns:
      the resolved token
    • parseFormat

      public String parseFormat(String dateFormatStr)
      Formates the current date with the input date format pattern
      Parameters:
      dateFormatStr - a valid patter for the SimpleDateFormat class
      Returns:
      the formated string
    • parseFormat

      public String parseFormat(String dateFormatStr, Date date)
      Formats the given date with the given date format pattern
      Parameters:
      dateFormatStr - a valid patter for the SimpleDateFormat Class
      date - the date to format
      Returns:
      the formatted string.