#4 Tree.Item

open
nobody
None
5
2007-11-02
2007-11-02
jgbr
No

The inner class Tree.Item is a final class.

Is is possible to remove the final keyword?

This would enable the cub-classing of Tree.Item.

For example we read category nodes from the database.
Each node has a identifier which helps to reference the object in the database. This identifier is set in the subclass of Tree.Item.

Example:

public class WNode extends Tree.Item {

private int treeId;

private int parentId;

private int nodeId;

/** resource can be the name of a HTML page */
private String resource;

public WNode() {
super();
}

public WNode(int treeId, int parentId, int nodeId, String text) {
super(text);
this.treeId = treeId;
this.parentId = parentId;
this.nodeId = nodeId;
}

public String toString() {
return "[" + treeId + "," + nodeId + "," + parentId + "] |"
+ super.getText() + "| {" + resource + "}";
}
}

Discussion