Package hec.gfx2d.text
Class DateTokenReplacer
java.lang.Object
hec.gfx2d.text.DateTokenReplacer
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionparseFormat
(String dateFormatStr) Formates the current date with the input date format patternparseFormat
(String dateFormatStr, Date date) Formats the given date with the given date format patternresolveToken
(String token, Object... args) Resolves the token into a string that can be replaced by the TextSubstitution Manager or null if the Token cannot be resoved
-
Constructor Details
-
DateTokenReplacer
public DateTokenReplacer()
-
-
Method Details
-
resolveToken
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 interfaceTokenReplacer
- Parameters:
token
- the token to be replacedargs
- the arguments that are needed for the replacer to resolve the token- Returns:
- the resolved token
-
parseFormat
Formates the current date with the input date format pattern- Parameters:
dateFormatStr
- a valid patter for the SimpleDateFormat class- Returns:
- the formated string
-
parseFormat
Formats the given date with the given date format pattern- Parameters:
dateFormatStr
- a valid patter for the SimpleDateFormat Classdate
- the date to format- Returns:
- the formatted string.
-