Class AddIndexStrategy
java.lang.Object
com.itextpdf.forms.fields.merging.AddIndexStrategy
- All Implemented Interfaces:
OnDuplicateFormFieldNameStrategy
A
OnDuplicateFormFieldNameStrategy implementation that adds an index to the field name of the second field-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newAddIndexStrategyinstance.AddIndexStrategy(String separator) Creates a newAddIndexStrategyinstance. -
Method Summary
Modifier and TypeMethodDescriptionbooleanexecute(PdfFormField firstField, PdfFormField secondField, boolean throwExceptionOnError) Renames the second field by adding an index to its name.(package private) intgetNextIndex(String name)
-
Field Details
-
DEFAULT_SEPARATOR
- See Also:
-
separator
-
countMap
-
regexString
-
-
Constructor Details
-
AddIndexStrategy
Creates a newAddIndexStrategyinstance.- Parameters:
separator- the separator that will be used to separate the original field name and the index
-
AddIndexStrategy
public AddIndexStrategy()Creates a newAddIndexStrategyinstance. The default separator will be used to separate the original field name and the index. the default separator is "_"
-
-
Method Details
-
execute
public boolean execute(PdfFormField firstField, PdfFormField secondField, boolean throwExceptionOnError) Renames the second field by adding an index to its name.- Specified by:
executein interfaceOnDuplicateFormFieldNameStrategy- Parameters:
firstField- the first fieldsecondField- the second fieldthrowExceptionOnError- if true, an exception will be thrown- Returns:
- returns
falsevalue, sinceAddIndexStrategynever merges fields.
-
getNextIndex
-