org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure

## Class PDStructureNode

- java.lang.Object
- - org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureNode

All Implemented Interfaces:
  COSObjectable

Direct Known Subclasses:
  PDStructureElement, PDStructureTreeRoot

    public abstract class PDStructureNode
    extends Object
    implements COSObjectable

A node in the structure tree.

Author:
  Johannes Koch

### Constructor Summary

Constructors
`protected` `PDStructureNode(COSDictionary dictionary)` Constructor for an existing structure node.
`protected` `PDStructureNode(String type)` Constructor.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`protected void` `appendKid(COSBase object)` Appends a COS base kid.
`void` `appendKid(PDStructureElement structureElement)` Appends a structure element kid and sets the parent property (/P) to this.
`protected void` `appendObjectableKid(COSObjectable objectable)` Appends an objectable kid.
`static PDStructureNode` `create(COSDictionary node)` Creates a node in the structure tree.
`protected Object` `createObject(COSBase kid)` Creates an object for a kid of this structure node.
`COSDictionary` `getCOSObject()` Convert this standard java object to a COS object.
`List<Object>` `getKids()` Returns a list of objects for the kids (K).
`String` `getType()` Returns the type.
`protected void` `insertBefore(COSBase newKid, Object refKid)` Inserts an COS base kid before a reference kid.
`void` `insertBefore(PDStructureElement newKid, Object refKid)` Inserts a structure element kid before a reference kid.
`protected void` `insertObjectableBefore(COSObjectable newKid, Object refKid)` Inserts an objectable kid before a reference kid.
`protected boolean` `removeKid(COSBase object)` Removes a COS base kid.
`boolean` `removeKid(PDStructureElement structureElement)` Removes a structure element kid and if successful also removes the parent property (/P).
`protected boolean` `removeObjectableKid(COSObjectable objectable)` Removes an objectable kid.
`void` `setKids(List<Object> kids)` Sets the kids (K).

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### PDStructureNode

    protected PDStructureNode(String type)

Constructor.

Parameters:
  `type` - the type

#### PDStructureNode

    protected PDStructureNode(COSDictionary dictionary)

Constructor for an existing structure node.

Parameters:
  `dictionary` - The existing dictionary.

### Method Detail

#### create

    public static PDStructureNode create(COSDictionary node)

Creates a node in the structure tree. Can be either a structure tree root, or a structure element.

Parameters:
  `node` - the node dictionary
Returns:
  the structure node

#### getCOSObject

    public COSDictionary getCOSObject()

Convert this standard java object to a COS object.

Specified by:
  `getCOSObject` in interface `COSObjectable`
Returns:
  The cos object that matches this Java object.

#### getType

    public String getType()

Returns the type.

Returns:
  the type

#### getKids

    public List<Object> getKids()

Returns a list of objects for the kids (K).

Returns:
  a list of objects for the kids, never null.

#### setKids

    public void setKids(List<Object> kids)

Sets the kids (K).

Parameters:
  `kids` - the kids

#### appendKid

    public void appendKid(PDStructureElement structureElement)

Appends a structure element kid and sets the parent property (/P) to this.

Parameters:
  `structureElement` - the structure element

#### appendObjectableKid

    protected void appendObjectableKid(COSObjectable objectable)

Appends an objectable kid.

Parameters:
  `objectable` - the objectable

#### appendKid

    protected void appendKid(COSBase object)

Appends a COS base kid.

Parameters:
  `object` - the COS base

#### insertBefore

    public void insertBefore(PDStructureElement newKid,
                             Object refKid)

Inserts a structure element kid before a reference kid.

Parameters:
  `newKid` - the structure element
  `refKid` - the reference kid

#### insertObjectableBefore

    protected void insertObjectableBefore(COSObjectable newKid,
                                          Object refKid)

Inserts an objectable kid before a reference kid.

Parameters:
  `newKid` - the objectable
  `refKid` - the reference kid

#### insertBefore

    protected void insertBefore(COSBase newKid,
                                Object refKid)

Inserts an COS base kid before a reference kid.

Parameters:
  `newKid` - the COS base
  `refKid` - the reference kid

#### removeKid

    public boolean removeKid(PDStructureElement structureElement)

Removes a structure element kid and if successful also removes the parent property (/P).

Parameters:
  `structureElement` - the structure element
Returns:
  `true` if the kid was removed, `false` otherwise.

#### removeObjectableKid

    protected boolean removeObjectableKid(COSObjectable objectable)

Removes an objectable kid.

Parameters:
  `objectable` - the objectable
Returns:
  `true` if the kid was removed, `false` otherwise

#### removeKid

    protected boolean removeKid(COSBase object)

Removes a COS base kid.

Parameters:
  `object` - the COS base
Returns:
  `true` if the kid was removed, `false` otherwise

#### createObject

    protected Object createObject(COSBase kid)

Creates an object for a kid of this structure node. The type of object depends on the type of the kid. It can be

- a `PDStructureElement`,
- a `PDObjectReference`,
- a `PDMarkedContentReference`,
- an `Integer`

Parameters:
  `kid` - the kid
Returns:
  the object