Class ProducerBuilder
- java.lang.Object
-
- com.itextpdf.commons.actions.AbstractITextEvent
-
- com.itextpdf.commons.actions.AbstractITextConfigurationEvent
-
- com.itextpdf.commons.actions.producer.ProducerBuilder
-
- All Implemented Interfaces:
IEvent
public final class ProducerBuilder extends AbstractITextConfigurationEvent
Class is used for producer line building.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringCOPYRIGHT_SINCEprivate static java.lang.StringCOPYRIGHT_TOprivate static java.lang.StringCURRENT_DATEprivate static charFORMAT_DELIMITERprivate static ProducerBuilderINSTANCEprivate static org.slf4j.LoggerLOGGERprivate static java.lang.StringMODIFIED_USINGprivate static java.util.regex.PatternPATTERNprivate static java.lang.StringPATTERN_STRINGPattern is used to search a placeholders.private static java.util.Map<java.lang.String,IPlaceholderPopulator>PLACEHOLDER_POPULATORSprivate static java.lang.StringUSED_PRODUCTS
-
Constructor Summary
Constructors Modifier Constructor Description privateProducerBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.StringbuildProducer(java.util.List<ConfirmedEventWrapper> events)protected voiddoAction()Configuration events for util internal purposes are not expected to be sent.static java.lang.StringmergeProducerLines(java.lang.String firstProducer, java.lang.String secondProducer)Merges two producer lines.static java.lang.StringmodifyProducer(java.util.List<? extends AbstractProductProcessITextEvent> events, java.lang.String oldProducer)Modifies an old producer line according to events registered for the document.private static java.lang.StringpopulatePlaceholders(java.lang.String producerLine, java.util.List<ConfirmedEventWrapper> events)-
Methods inherited from class com.itextpdf.commons.actions.AbstractITextConfigurationEvent
addEvent, addProcessor, getActiveProcessor, getEvents, getProcessors, registerInternalNamespace, removeProcessor
-
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
INSTANCE
private static final ProducerBuilder INSTANCE
-
CURRENT_DATE
private static final java.lang.String CURRENT_DATE
- See Also:
- Constant Field Values
-
USED_PRODUCTS
private static final java.lang.String USED_PRODUCTS
- See Also:
- Constant Field Values
-
COPYRIGHT_SINCE
private static final java.lang.String COPYRIGHT_SINCE
- See Also:
- Constant Field Values
-
COPYRIGHT_TO
private static final java.lang.String COPYRIGHT_TO
- See Also:
- Constant Field Values
-
FORMAT_DELIMITER
private static final char FORMAT_DELIMITER
- See Also:
- Constant Field Values
-
MODIFIED_USING
private static final java.lang.String MODIFIED_USING
- See Also:
- Constant Field Values
-
PATTERN_STRING
private static final java.lang.String PATTERN_STRING
Pattern is used to search a placeholders. Currently it searches substrings started with${and ended with}without}character inside. These substrings are interpreted as placeholders and the first group is the content of the placeholder. Note: The escape on '}' is necessary for regex dialect compatibility reasons.- See Also:
- Constant Field Values
-
PATTERN
private static final java.util.regex.Pattern PATTERN
-
PLACEHOLDER_POPULATORS
private static final java.util.Map<java.lang.String,IPlaceholderPopulator> PLACEHOLDER_POPULATORS
-
-
Method Detail
-
modifyProducer
public static java.lang.String modifyProducer(java.util.List<? extends AbstractProductProcessITextEvent> events, java.lang.String oldProducer)
Modifies an old producer line according to events registered for the document. Events can be either wrapped withConfirmedEventWrapperor not. Format of the new producer line will be defined by the first event in the list. Placeholder will be replaced and merged all together.- Parameters:
events- list of events registered for the documentoldProducer- old producer line. Ifnullor empty, will be replaced with a new one. Otherwise new line will be attached withmodified usingprefix. If old producer line already containsmodified using itextsubstring with the current version of itext at the end, no changes will be made- Returns:
- modified producer line
-
mergeProducerLines
public static java.lang.String mergeProducerLines(java.lang.String firstProducer, java.lang.String secondProducer)Merges two producer lines. If first producer linenullor empty, it will be replaced with the second one. Otherwise second producer line will be attached withmodified usingprefix. If first producer line already containsmodified usingsubstring with the second producer line at the end, first producer line will be returned unchanged.- Parameters:
firstProducer- first producer linesecondProducer- second producer line- Returns:
- modified producer line
-
doAction
protected void doAction()
Configuration events for util internal purposes are not expected to be sent.- Specified by:
doActionin classAbstractITextConfigurationEvent- Throws:
java.lang.IllegalStateException- on every method call
-
buildProducer
private static java.lang.String buildProducer(java.util.List<ConfirmedEventWrapper> events)
-
populatePlaceholders
private static java.lang.String populatePlaceholders(java.lang.String producerLine, java.util.List<ConfirmedEventWrapper> events)
-
-