Top Description Inners Fields Constructors Methods
org.apache.pdfbox.pdmodel.interactive.form

public final Class FieldUtils

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collections, .Comparator, .List, org.apache.pdfbox.cos.COSArray, .COSBase, .COSString

A set of utility methods to help with common AcroForm form and field related functions.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
FieldUtils.KeyValue

An implementation of a basic key value pair.

Field Summary

Modifier and TypeField and Description
pack-priv static final Comparator<FieldUtils.KeyValue>
pack-priv static final Comparator<FieldUtils.KeyValue>

Constructor Summary

AccessConstructor and Description
private
FieldUtils()

Constructor.

Method Summary

Modifier and TypeMethod and Description
pack-priv static List<String>

Returns:

a List of single elements
getPairableItems
(COSBase
the array of elements or two-element arrays
items
,
int
the index into the two-element array
pairIdx
)

Return either one of a list which can have two-element arrays entries.

pack-priv static void
sortByKey(List<FieldUtils.KeyValue>
a list of KeyValue elements
pairs
)

Sort two related lists simultaneously by the elements in the value parameter.

pack-priv static void
sortByValue(List<FieldUtils.KeyValue>
a list of KeyValue elements
pairs
)

Sort two related lists simultaneously by the elements in the key parameter.

pack-priv static List<FieldUtils.KeyValue>

Returns:

a sorted list of KeyValue elements.
toKeyValueList
(List<String>
the key elements
key
,
List<String>
the value elements
value
)

Return two related lists as a single list with key value pairs.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BY_KEY_COMPARATORback to summary
pack-priv static final Comparator<FieldUtils.KeyValue> BY_KEY_COMPARATOR
BY_VALUE_COMPARATORback to summary
pack-priv static final Comparator<FieldUtils.KeyValue> BY_VALUE_COMPARATOR

Constructor Detail

FieldUtilsback to summary
private FieldUtils()

Constructor.

Method Detail

getPairableItemsback to summary
pack-priv static List<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 IllegalArgumentException will be thrown if the items contain two-element arrays and the index is not 0 or 1.

Parameters
items:COSBase

the array of elements or two-element arrays

pairIdx:int

the index into the two-element array

Returns:List<String>

a List of single elements

sortByKeyback to summary
pack-priv static void sortByKey(List<FieldUtils.KeyValue> pairs)

Sort two related lists simultaneously by the elements in the value parameter.

Parameters
pairs:List<FieldUtils.KeyValue>

a list of KeyValue elements

sortByValueback to summary
pack-priv static void sortByValue(List<FieldUtils.KeyValue> pairs)

Sort two related lists simultaneously by the elements in the key parameter.

Parameters
pairs:List<FieldUtils.KeyValue>

a list of KeyValue elements

toKeyValueListback to summary
pack-priv static List<FieldUtils.KeyValue> toKeyValueList(List<String> key, List<String> value)

Return two related lists as a single list with key value pairs.

Parameters
key:List<String>

the key elements

value:List<String>

the value elements

Returns:List<FieldUtils.KeyValue>

a sorted list of KeyValue elements.

org.apache.pdfbox.pdmodel.interactive.form back to summary

pack-priv Class FieldUtils.KeyValue

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.pdfbox.pdmodel.interactive.form.FieldUtils.KeyValue

An implementation of a basic key value pair. This implementation is used to help sorting the content of field option entries with an array of two-element arrays as used by choice fields.

Field Summary

Modifier and TypeField and Description
private final String
private final String

Constructor Summary

AccessConstructor and Description
pack-priv
KeyValue(final String theKey, final String theValue)

Method Summary

Modifier and TypeMethod and Description
public String
public String
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

keyback to summary
private final String key
valueback to summary
private final String value

Constructor Detail

KeyValueback to summary
pack-priv KeyValue(final String theKey, final String theValue)

Method Detail

getKeyback to summary
public String getKey()
getValueback to summary
public String getValue()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override