Class UsedProductsPlaceholderPopulator
- All Implemented Interfaces:
IPlaceholderPopulator
usedProducts
placeholder. Placeholder should be configured
with parameter defining the format of output. Within format strings, unquoted letters from
A
to Z
and from a
to z
are process as pattern
letters representing appropriate component of usedProducts
format. There are three
letters which are allowed in the outputformat:
P
stands for product nameV
stands for version of the productT
is for usage type of the product
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 the list of all products mentioned among events as a
comma-separated list. The order of the elements is defined by the order of products mentioning in
the events
. Equal strings are skipped even if they were generated for different
products (i. e. format P
stands for product name only: if several version of the
same product are used, it will be the only mentioning of that product).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final char
private static final String
private static final char
private static final char
Fields inherited from class com.itextpdf.commons.actions.producer.AbstractFormattedPlaceholderPopulator
APOSTROPHE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate String
formatLetter
(char letter, UsedProductsPlaceholderPopulator.ProductRepresentation product) private String
formatProduct
(UsedProductsPlaceholderPopulator.ProductRepresentation product, String format) populate
(List<ConfirmedEventWrapper> events, String parameter) Builds a replacement for a placeholderusedProducts
in accordance with the registered events and provided format.Methods inherited from class com.itextpdf.commons.actions.producer.AbstractFormattedPlaceholderPopulator
attachQuotedString, isLetter
-
Field Details
-
PRODUCT_NAME
private static final char PRODUCT_NAME- See Also:
-
VERSION
private static final char VERSION- See Also:
-
USAGE_TYPE
private static final char USAGE_TYPE- See Also:
-
PRODUCTS_SEPARATOR
- See Also:
-
-
Constructor Details
-
UsedProductsPlaceholderPopulator
public UsedProductsPlaceholderPopulator()
-
-
Method Details
-
populate
Builds a replacement for a placeholderusedProducts
in accordance with the registered events and provided format.- Parameters:
events
- is a list of event involved into document processingparameter
- defines output format in accordance with the for description- Returns:
- populated comma-separated list of used products in accordance with the format
- Throws:
IllegalArgumentException
- if format of the pattern is invalid
-
formatProduct
private String formatProduct(UsedProductsPlaceholderPopulator.ProductRepresentation product, String format) -
formatLetter
private String formatLetter(char letter, UsedProductsPlaceholderPopulator.ProductRepresentation product)
-