Annotation Type Parent


@Documented @Target(FIELD) @Retention(RUNTIME) public @interface Parent
Represents a reference to the parent identifier of an object in a tree model.

When the API Transformation Process is triggered through the TreeTransaction.initializeSession(String, java.util.Collection) method, this annotation indicates to the core API that, during the tree building, the @Id of an object will be linked to the @Id of another object that represents its parent when the tree is built.

When the @Parent identifier is not found or is null, then this object has an unknown parent and will be placed at the root level of the tree (first level).

Example:
@Tree
public class Folder {

    @Id
    private String folderId;
    @Parent
    private String parentFolderId;

    private String anyAttribute;
    ...
}
The @Id and @Parent must have the same class type.
Author:
Diego Madson de Andrade Nóbrega
See Also: