Developing with the SDK > Using and Writing Data Models > NonJavaBeans Example: Abstract Model Variant > The TreeSDMLink Class

The class TreeSDMLink represents the links of the graph. Its definition is as shown in Code Sample 2.27.

public class TreeSDMLink implements IlvSDMLink
{
...

Code Sample 2.27 A Link Based on the SDM Link

The link implementation can therefore make use of all the predefined methods of the IlvSDMLink interface.

Data Stored

Each link has a reference to a parent node and a child node, which can be retrieved using the getFrom and getTo methods, see Code Sample 2.28.

  private TreeSDMNode parent, child;

  public TreeSDMLink(TreeSDMNode parent, TreeSDMNode child)
  {
    this.parent = parent;
    this.child = child;
  }

  public IlvSDMNode getFrom()
  {
    return parent;
  }

  public IlvSDMNode getTo()
  {
    return child;
  }

Code Sample 2.28 Keeping Track of Link Data: Parent and Child

Implementation of the IlvSDMNode Interface

The IlvSDMLink interface inherits from the IlvSDMNode interface and so the same methods must be implemented as for a node.

The tag (type) of links is treelink. and this value can be retrieved using the getTag method, see Code Sample 2.29.

public String getTag()
  {
    return "treelink";
  }

Code Sample 2.29 Retrieving the Link Type: the getTag Method

The remaining methods are mostly empty, since in this example links have no properties.