Class UsedProductsPlaceholderPopulator
- java.lang.Object
-
- com.itextpdf.commons.actions.producer.AbstractFormattedPlaceholderPopulator
-
- com.itextpdf.commons.actions.producer.UsedProductsPlaceholderPopulator
-
- All Implemented Interfaces:
IPlaceholderPopulator
class UsedProductsPlaceholderPopulator extends AbstractFormattedPlaceholderPopulator
Class is used to populateusedProducts
placeholder. Placeholder should be configured with parameter defining the format of output. Within format strings, unquoted letters fromA
toZ
and froma
toz
are process as pattern letters representing appropriate component ofusedProducts
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. formatP
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 Classes Modifier and Type Class Description private static class
UsedProductsPlaceholderPopulator.ProductRepresentation
-
Field Summary
Fields Modifier and Type Field Description private static char
PRODUCT_NAME
private static java.lang.String
PRODUCTS_SEPARATOR
private static char
USAGE_TYPE
private static char
VERSION
-
Fields inherited from class com.itextpdf.commons.actions.producer.AbstractFormattedPlaceholderPopulator
APOSTROPHE
-
-
Constructor Summary
Constructors Constructor Description UsedProductsPlaceholderPopulator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.String
formatLetter(char letter, UsedProductsPlaceholderPopulator.ProductRepresentation product)
private java.lang.String
formatProduct(UsedProductsPlaceholderPopulator.ProductRepresentation product, java.lang.String format)
java.lang.String
populate(java.util.List<ConfirmedEventWrapper> events, java.lang.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 Detail
-
PRODUCT_NAME
private static final char PRODUCT_NAME
- See Also:
- Constant Field Values
-
VERSION
private static final char VERSION
- See Also:
- Constant Field Values
-
USAGE_TYPE
private static final char USAGE_TYPE
- See Also:
- Constant Field Values
-
PRODUCTS_SEPARATOR
private static final java.lang.String PRODUCTS_SEPARATOR
- See Also:
- Constant Field Values
-
-
Method Detail
-
populate
public java.lang.String populate(java.util.List<ConfirmedEventWrapper> events, java.lang.String parameter)
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:
java.lang.IllegalArgumentException
- if format of the pattern is invalid
-
formatProduct
private java.lang.String formatProduct(UsedProductsPlaceholderPopulator.ProductRepresentation product, java.lang.String format)
-
formatLetter
private java.lang.String formatLetter(char letter, UsedProductsPlaceholderPopulator.ProductRepresentation product)
-
-