Class FieldUtils
java.lang.Object
org.apache.pdfbox.pdmodel.interactive.form.FieldUtils
A set of utility methods to help with common AcroForm form and field related functions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
An implementation of a basic key value pair.(package private) static class
Comparator to sort KeyValue by key.(package private) static class
Comparator to sort KeyValue by value. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetPairableItems
(COSBase items, int pairIdx) Return either one of a list which can have two-element arrays entries.(package private) static void
sortByKey
(List<FieldUtils.KeyValue> pairs) Sort two related lists simultaneously by the elements in the value parameter.(package private) static void
sortByValue
(List<FieldUtils.KeyValue> pairs) Sort two related lists simultaneously by the elements in the key parameter.(package private) static List<FieldUtils.KeyValue>
toKeyValueList
(List<String> key, List<String> value) Return two related lists as a single list with key value pairs.
-
Constructor Details
-
FieldUtils
private FieldUtils()Constructor.
-
-
Method Details
-
toKeyValueList
Return two related lists as a single list with key value pairs.- Parameters:
key
- the key elementsvalue
- the value elements- Returns:
- a sorted list of KeyValue elements.
-
sortByValue
Sort two related lists simultaneously by the elements in the key parameter.- Parameters:
pairs
- a list of KeyValue elements
-
sortByKey
Sort two related lists simultaneously by the elements in the value parameter.- Parameters:
pairs
- a list of KeyValue elements
-
getPairableItems
Return either one of a list which can have two-element arrays entries.Some entries in a dictionary can either be an array of elements or an array of two-element arrays. This method will either return the elements in the array or in case of two-element arrays, the element designated by the pair index
An
IllegalArgumentException
will be thrown if the items contain two-element arrays and the index is not 0 or 1.- Parameters:
items
- the array of elements or two-element arrayspairIdx
- the index into the two-element array- Returns:
- a List of single elements
-