Skip to main content

@ParentProperty Annotation

The @ParentProperty annotation is used to identify a setter as a method for adding a parent reference to a child object.

A commonly-used case is when you're parsing beans and a child bean has a reference to a parent bean.

public class AddressBook {
public List people;
}

public class Person {

@ParentProperty
public AddressBook addressBook; // A reference to the containing address book.

public String name;

public char sex;
}

Parsers will automatically set this field for you in the child beans.