Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.common

public Class PDNumberTreeNode

extends Object
implements COSObjectable
Class Inheritance
All Implemented Interfaces
org.apache.pdfbox.pdmodel.common.COSObjectable
Imports
java.io.IOException, java.util.ArrayList, .Collections, .HashMap, .List, .Map, org.apache.commons.logging.Log, .LogFactory, org.apache.pdfbox.cos.COSArray, .COSBase, .COSDictionary, .COSInteger, .COSName, .COSNull

This class represents a PDF Number tree. See the PDF Reference 1.7 section 7.9.7 for more details.
Authors
Ben Litchfield,, Igor Podolskiy

Field Summary

Modifier and TypeField and Description
private static final Log
private final COSDictionary
private Class<? extends COSObjectable>

Constructor Summary

AccessConstructor and Description
public
PDNumberTreeNode(Class<? extends COSObjectable>
The PD Model type of object that is the value.
valueClass
)

Constructor.

public
PDNumberTreeNode(COSDictionary
The dictionary that holds the number information.
dict
,
Class<? extends COSObjectable>
The PD Model type of object that is the value.
valueClass
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
protected COSObjectable

Returns:

The converted PD Model object.
convertCOSToPD
(COSBase
The COS object to convert.
base
)

Method to convert the COS value in the number tree to the PD Model object.

protected PDNumberTreeNode

Returns:

The new child node object.
createChildNode
(COSDictionary
The dictionary for the child node object to refer to.
dic
)

Create a child node object.

public COSDictionary

Returns:

The cos object that matches this Java object.
getCOSObject
()

Implements org.apache.pdfbox.pdmodel.common.COSObjectable.getCOSObject.

Convert this standard java object to a COS object.

public List<PDNumberTreeNode>

Returns:

The list of children or null if there are no children.
getKids
()

Return the children of this node.

public Integer

Returns:

The lowest value for a key in the map.
getLowerLimit
()

Get the lowest value for a key in the number map.

public Map<Integer, COSObjectable>

Returns:

A map of COS objects.
getNumbers
()

This will return a map of numbers on this level.

public Integer

Returns:

The highest value for a key in the map.
getUpperLimit
()

Get the highest value for a key in the number map.

public Object

Returns:

The value corresponding to the index.
getValue
(Integer
The index in the number tree.
index
)

Returns the value corresponding to an index in the number tree.

public void
setKids(List<? extends PDNumberTreeNode>
The children of this number tree. These have to be in sorted order. Because of that, it is usually easier to call setNumbers(Map) with a map and pass a single element list here.
kids
)

Set the children of this number tree.

private void
setLowerLimit(Integer
The new lowest value for a key in the map.
lower
)

Set the lowest value for the key in the map.

public void
setNumbers(Map<Integer, ? extends COSObjectable>
The map of numbers to objects, or null for nothing.
numbers
)

Set the numbers for this node.

private void
setUpperLimit(Integer
The new highest value for a key in the map.
upper
)

Set the highest value for the key in the map.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGback to summary
private static final Log LOG
nodeback to summary
private final COSDictionary node
valueTypeback to summary
private Class<? extends COSObjectable> valueType

Constructor Detail

PDNumberTreeNodeback to summary
public PDNumberTreeNode(Class<? extends COSObjectable> valueClass)

Constructor.

Parameters
valueClass:Class<? extends COSObjectable>

The PD Model type of object that is the value.

PDNumberTreeNodeback to summary
public PDNumberTreeNode(COSDictionary dict, Class<? extends COSObjectable> valueClass)

Constructor.

Parameters
dict:COSDictionary

The dictionary that holds the number information.

valueClass:Class<? extends COSObjectable>

The PD Model type of object that is the value.

Method Detail

convertCOSToPDback to summary
protected COSObjectable convertCOSToPD(COSBase base) throws IOException

Method to convert the COS value in the number tree to the PD Model object. The default implementation will simply use reflection to create the correct object type. Subclasses can do whatever they want.

Parameters
base:COSBase

The COS object to convert.

Returns:COSObjectable

The converted PD Model object.

Exceptions
IOException:
If there is an error during creation.
createChildNodeback to summary
protected PDNumberTreeNode createChildNode(COSDictionary dic)

Create a child node object.

Parameters
dic:COSDictionary

The dictionary for the child node object to refer to.

Returns:PDNumberTreeNode

The new child node object.

getCOSObjectback to summary
public COSDictionary getCOSObject()

Implements org.apache.pdfbox.pdmodel.common.COSObjectable.getCOSObject.

Convert this standard java object to a COS object.

Returns:COSDictionary

The cos object that matches this Java object.

Annotations
@Override
getKidsback to summary
public List<PDNumberTreeNode> getKids()

Return the children of this node. This list will contain PDNumberTreeNode objects.

Returns:List<PDNumberTreeNode>

The list of children or null if there are no children.

getLowerLimitback to summary
public Integer getLowerLimit()

Get the lowest value for a key in the number map.

Returns:Integer

The lowest value for a key in the map.

getNumbersback to summary
public Map<Integer, COSObjectable> getNumbers() throws IOException

This will return a map of numbers on this level. The key will be a java.lang.Integer, the value will depend on where this class is being used.

Returns:Map<Integer, COSObjectable>

A map of COS objects.

Exceptions
IOException:
If there is a problem creating the values.
getUpperLimitback to summary
public Integer getUpperLimit()

Get the highest value for a key in the number map.

Returns:Integer

The highest value for a key in the map.

getValueback to summary
public Object getValue(Integer index) throws IOException

Returns the value corresponding to an index in the number tree.

Parameters
index:Integer

The index in the number tree.

Returns:Object

The value corresponding to the index.

Exceptions
IOException:
If there is a problem creating the values.
setKidsback to summary
public void setKids(List<? extends PDNumberTreeNode> kids)

Set the children of this number tree.

Parameters
kids:List<? extends PDNumberTreeNode>

The children of this number tree. These have to be in sorted order. Because of that, it is usually easier to call setNumbers(Map) with a map and pass a single element list here.

setLowerLimitback to summary
private void setLowerLimit(Integer lower)

Set the lowest value for the key in the map.

Parameters
lower:Integer

The new lowest value for a key in the map.

setNumbersback to summary
public void setNumbers(Map<Integer, ? extends COSObjectable> numbers)

Set the numbers for this node. This method will set the appropriate upper and lower limits based on the keys in the map and take care of the ordering.

Parameters
numbers:Map<Integer, ? extends COSObjectable>

The map of numbers to objects, or null for nothing.

setUpperLimitback to summary
private void setUpperLimit(Integer upper)

Set the highest value for the key in the map.

Parameters
upper:Integer

The new highest value for a key in the map.