Class CurrentDatePlaceholderPopulator
- java.lang.Object
-
- com.itextpdf.commons.actions.producer.AbstractFormattedPlaceholderPopulator
-
- com.itextpdf.commons.actions.producer.CurrentDatePlaceholderPopulator
-
- All Implemented Interfaces:
IPlaceholderPopulator
class CurrentDatePlaceholderPopulator extends AbstractFormattedPlaceholderPopulator
Class is used to populatecurrentDateplaceholder. Placeholder should be configured with parameter defining the format of date output. Within format strings, unquoted letters fromAtoZand fromatozare process as pattern letters. Chain of equal pattern letters forms an appropriate component ofcurrentDateformat. There following components are supported:dis for the day of the month, from 1 through 31ddis for the day of the month, from 01 through 31Mdefines the month from 1 to 12MMdefines the month from 01 to 12MMMdefines the abbreviated name of the monthMMMMdefines the full name of monthyymeans the year from 00 to 99yyyymeans the year in for digits formatsshows current second, from 0 through 59ssshows current second, from 00 through 59mis replaced with the current minute from 0 to 59mmis replaced with the current minute from 00 to 59Hstands for the current hour, using a 24-hour clock from 0 to 23HHstands for the current hour, using a 24-hour clock from 00 to 23
Text can be quoted using single quotes (') to avoid interpretation. All other characters are not interpreted and just copied into the output string. String may contain escaped apostrophes
\'which processed as characters. Backslash is used for escaping so you need double backslash to print it\\. All the rest backslashes (not followed by apostrophe or one more backslash) are simply ignored.The result of the processing is current date representing in accordance with the provided format.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Set<java.lang.String>ALLOWED_PATTERNS-
Fields inherited from class com.itextpdf.commons.actions.producer.AbstractFormattedPlaceholderPopulator
APOSTROPHE
-
-
Constructor Summary
Constructors Constructor Description CurrentDatePlaceholderPopulator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.StringformatDate(java.util.Date date, java.lang.String format)java.lang.Stringpopulate(java.util.List<ConfirmedEventWrapper> events, java.lang.String parameter)Builds a replacement for a placeholdercurrentDatein accordance with the provided format.private intprocessDateComponent(int index, java.util.Date date, java.lang.StringBuilder builder, char[] formatArray)-
Methods inherited from class com.itextpdf.commons.actions.producer.AbstractFormattedPlaceholderPopulator
attachQuotedString, isLetter
-
-
-
-
Method Detail
-
populate
public java.lang.String populate(java.util.List<ConfirmedEventWrapper> events, java.lang.String parameter)
Builds a replacement for a placeholdercurrentDatein accordance with the provided format.- Parameters:
events- is a list of event involved into document processing. It is not used during the placeholder replacementparameter- defines output format in accordance with the description- Returns:
- date of producer line creation in accordance with defined format
- Throws:
java.lang.IllegalArgumentException- if format of the date pattern is invalid
-
formatDate
private java.lang.String formatDate(java.util.Date date, java.lang.String format)
-
processDateComponent
private int processDateComponent(int index, java.util.Date date, java.lang.StringBuilder builder, char[] formatArray)
-
-