Class FieldUtils
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.interactive.form.FieldUtils
-
public final class FieldUtils extends java.lang.ObjectA set of utility methods to help with common AcroForm form and field related functions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classFieldUtils.KeyValueAn implementation of a basic key value pair.
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.util.Comparator<FieldUtils.KeyValue>BY_KEY_COMPARATOR(package private) static java.util.Comparator<FieldUtils.KeyValue>BY_VALUE_COMPARATOR
-
Constructor Summary
Constructors Modifier Constructor Description privateFieldUtils()Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static java.util.List<java.lang.String>getPairableItems(COSBase items, int pairIdx)Return either one of a list which can have two-element arrays entries.(package private) static voidsortByKey(java.util.List<FieldUtils.KeyValue> pairs)Sort two related lists simultaneously by the elements in the value parameter.(package private) static voidsortByValue(java.util.List<FieldUtils.KeyValue> pairs)Sort two related lists simultaneously by the elements in the key parameter.(package private) static java.util.List<FieldUtils.KeyValue>toKeyValueList(java.util.List<java.lang.String> key, java.util.List<java.lang.String> value)Return two related lists as a single list with key value pairs.
-
-
-
Field Detail
-
BY_VALUE_COMPARATOR
static final java.util.Comparator<FieldUtils.KeyValue> BY_VALUE_COMPARATOR
-
BY_KEY_COMPARATOR
static final java.util.Comparator<FieldUtils.KeyValue> BY_KEY_COMPARATOR
-
-
Method Detail
-
toKeyValueList
static java.util.List<FieldUtils.KeyValue> toKeyValueList(java.util.List<java.lang.String> key, java.util.List<java.lang.String> value)
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
static void sortByValue(java.util.List<FieldUtils.KeyValue> pairs)
Sort two related lists simultaneously by the elements in the key parameter.- Parameters:
pairs- a list of KeyValue elements
-
sortByKey
static void sortByKey(java.util.List<FieldUtils.KeyValue> pairs)
Sort two related lists simultaneously by the elements in the value parameter.- Parameters:
pairs- a list of KeyValue elements
-
getPairableItems
static java.util.List<java.lang.String> getPairableItems(COSBase items, int pairIdx)
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
IllegalArgumentExceptionwill 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
-
-