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

com.github.davidmoten.oas3.internal.model.Inheritance Maven / Gradle / Ivy

The newest version!
package com.github.davidmoten.oas3.internal.model;

import java.util.List;
import java.util.Objects;
import java.util.Optional;

public final class Inheritance implements Relationship {
    private final String from;
    private final List to;
    private final AssociationType type;
    private final Optional propertyName;

    public Inheritance(String from, List to, AssociationType type, Optional propertyName) {
        this.from = from;
        this.to = to;
        this.type = type;
        this.propertyName = propertyName;
    }

    public String from() {
        return from;
    }

    public List to() {
        return to;
    }

    public AssociationType type() {
        return type;
    }

    public Optional propertyName() {
        return propertyName;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("Inheritance [from=");
        b.append(from);
        b.append(", to=");
        b.append(to);
        b.append(", type=");
        b.append(type);
        b.append(", propertyName=");
        b.append(propertyName);
        b.append("]");
        return b.toString();
    }

    @Override
    public int hashCode() {
        return Objects.hash(from, propertyName, to, type);
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        Inheritance other = (Inheritance) obj;
        return Objects.equals(from, other.from) && Objects.equals(propertyName, other.propertyName)
                && Objects.equals(to, other.to) && type == other.type;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy