Annotation Type Id


@Documented @Target(FIELD) @Retention(RUNTIME) public @interface Id
Represents the identifier of a tree node class. This annotation must be applied to a field that uniquely identifies each node within the tree structure.

The field annotated with @Id is used by the core API to assemble and manage the tree nodes effectively. The assembly process relies on this identifier to distinguish between different nodes and to establish parent-child relationships. It happens when the API client passes a collection of linear objects that have a hierarchical relationship through this identifier, to be organized into a tree structure through the TreeTransaction.initializeSession(String, java.util.Collection) method. This process is known as API Transformation Process.

It is mandatory that the field annotated with @Id has a unique value within the tree structure and is not null.

Example:
@Tree
public class TreeNode {
    @Id
    private String index;
    @Parent
    private String parentIndex;

    private String anyAttribute;
    ...
}
Author:
Diego Madson de Andrade Nóbrega
See Also: