Eclipse Platform Release 3.7

## org.eclipse.jface.viewers
Class TreeNode

    java.lang.Object
      org.eclipse.jface.viewers.TreeNode

    public class TreeNode

extends Object

A simple data structure that is useful for implemented tree models. This can be returned by `IStructuredContentProvider.getElements(Object)`. It allows simple delegation of methods from `ITreeContentProvider` such as `ITreeContentProvider.getChildren(Object)`, `ITreeContentProvider.getParent(Object)` and `ITreeContentProvider.hasChildren(Object)`

Since:
  3.2

Field Summary
`protected Object` `value` The value contained in this node.

Constructor Summary
`TreeNode(Object value)` Constructs a new instance of `TreeNode`.

Method Summary
`boolean` `equals(Object object)`
`TreeNode[]` `getChildren()` Returns the child nodes.
`TreeNode` `getParent()` Returns the parent node.
`Object` `getValue()` Returns the value held by this node.
`boolean` `hasChildren()` Returns whether the tree has any children.
`int` `hashCode()`
`void` `setChildren(TreeNode[] children)` Sets the children for this node.
`void` `setParent(TreeNode parent)` Sets the parent for this node.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### value

    protected Object value

  The value contained in this node. This value may be anything.

Constructor Detail

### TreeNode

    public TreeNode(Object value)

  Constructs a new instance of `TreeNode`.

  Parameters:
    `value` - The value held by this node; may be anything.

Method Detail

### equals

    public boolean equals(Object object)

  Overrides:
    `equals` in class `Object`

### getChildren

    public TreeNode[] getChildren()

  Returns the child nodes. Empty arrays are converted to `null` before being returned.

  Returns:
    The child nodes; may be `null`, but never empty. There should be no `null` children in the array.

### getParent

    public TreeNode getParent()

  Returns the parent node.

  Returns:
    The parent node; may be `null` if there are no parent nodes.

### getValue

    public Object getValue()

  Returns the value held by this node.

  Returns:
    The value; may be anything.

### hasChildren

    public boolean hasChildren()

  Returns whether the tree has any children.

  Returns:
    `true` if its array of children is not `null` and is non-empty; `false` otherwise.

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### setChildren

    public void setChildren(TreeNode[] children)

  Sets the children for this node.

  Parameters:
    `children` - The child nodes; may be `null` or empty. There should be no `null` children in the array.

### setParent

    public void setParent(TreeNode parent)

  Sets the parent for this node.

  Parameters:
    `parent` - The parent node; may be `null`.

Eclipse Platform Release 3.7

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.