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 populateusedProductsplaceholder. Placeholder should be configured with parameter defining the format of output. Within format strings, unquoted letters fromAtoZand fromatozare process as pattern letters representing appropriate component ofusedProductsformat. There are three letters which are allowed in the outputformat:Pstands for product nameVstands for version of the productTis 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. formatPstands 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 classUsedProductsPlaceholderPopulator.ProductRepresentation
-
Field Summary
Fields Modifier and Type Field Description private static charPRODUCT_NAMEprivate static java.lang.StringPRODUCTS_SEPARATORprivate static charUSAGE_TYPEprivate static charVERSION-
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.StringformatLetter(char letter, UsedProductsPlaceholderPopulator.ProductRepresentation product)private java.lang.StringformatProduct(UsedProductsPlaceholderPopulator.ProductRepresentation product, java.lang.String format)java.lang.Stringpopulate(java.util.List<ConfirmedEventWrapper> events, java.lang.String parameter)Builds a replacement for a placeholderusedProductsin 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 placeholderusedProductsin 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)
-
-