Skip to content

Inheritance

Ahmad K. Bawaneh edited this page Dec 24, 2019 · 2 revisions

Inheritance

Domino-jackson support (de)serialize of super classes fields in the pojo mappers. e.g the following is a valid pojo for (de)serialization

public abstract class BasePojo {

    private int id;
    private String name;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
@JSONMapper
public class ChildPojo extends BasePojo {

    private String address;

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
}

the all fields from base class id and name and the fields from the child class address will be included in the (de)serializers.

Inheritance can be as deep as needed.

Clone this wiki locally