All Downloads are FREE. Search and download functionalities are using the official Maven repository.

no.unit.nva.model.Organization Maven / Gradle / Ivy

There is a newer version: 0.23.2
Show newest version
package no.unit.nva.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import java.net.URI;
import java.util.Collections;
import java.util.Map;
import java.util.Objects;
import nva.commons.core.JacocoGenerated;

@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
public class Organization implements Agent {

    @JsonProperty("id")
    private URI id;
    @JsonProperty("labels")
    private Map labels;

    public Organization() {
    }

    private Organization(Builder builder) {
        setId(builder.id);
        setLabels(builder.labels);
    }

    public URI getId() {
        return id;
    }

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

    public Map getLabels() {
        return Objects.nonNull(labels) ? labels : Collections.emptyMap();
    }

    public void setLabels(Map labels) {
        this.labels = labels;
    }

    @JacocoGenerated
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Organization that = (Organization) o;
        return Objects.equals(getId(), that.getId())
               && Objects.equals(getLabels(), that.getLabels());
    }

    @JacocoGenerated
    @Override
    public int hashCode() {
        return Objects.hash(getId(), getLabels());
    }

    public static final class Builder {

        private URI id;
        private Map labels;

        public Builder() {
        }

        public Builder withId(URI id) {
            this.id = id;
            return this;
        }

        public Builder withLabels(Map labels) {
            this.labels = labels;
            return this;
        }

        public Organization build() {
            return new Organization(this);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy