Include.java

package info.textgrid.services.textapi;

import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonInclude;

import java.util.ArrayList;
import java.util.List;

/**
 * Represents an inclusion rule from the "include" section of a field override
 * configuration. For the resource whose ID matches "in", only the IDs listed
 * under "target" will be present in its list (collections, manifests or items).
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Include {

    /**
     * The ID of the resource receiving the filtered inclusion list.
     */
    private String in;

    /**
     * List of IDs that will compose (or be retained within) the resource's list.
     */
    private List<String> target;

    public String getIn() {
        return in;
    }

    public void setIn(String in) {
        this.in = in;
    }

    public List<String> getTarget() {
        return target;
    }

    public void setTarget(List<String> target) {
        this.target = target;
    }

    public void addTarget(String target) {
        if (this.target == null) {
            this.target = new ArrayList<>();
        }
        this.target.add(target);
    }
}