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

com.kenshoo.pl.entity.internal.fetch.OneToOneTableRelation Maven / Gradle / Ivy

Go to download

A Java persistence layer based on JOOQ for high performance and business flow support.

There is a newer version: 0.1.121-jooq-3.16.3
Show newest version
package com.kenshoo.pl.entity.internal.fetch;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.jooq.Record;
import org.jooq.Table;

import static java.util.Objects.requireNonNull;

public class OneToOneTableRelation {
    private final Table primary;
    private final Table secondary;

    private OneToOneTableRelation(final Table primary, final Table secondary) {
        this.primary = requireNonNull(primary, "A primary table must be specified");
        this.secondary = requireNonNull(secondary, "A secondary table must be specified");
    }

    public Table getPrimary() {
        return primary;
    }

    public Table getSecondary() {
        return secondary;
    }

    public static Builder builder() {
        return new Builder();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (o == null || getClass() != o.getClass()) return false;

        OneToOneTableRelation that = (OneToOneTableRelation) o;

        return new EqualsBuilder()
                .append(primary, that.primary)
                .append(secondary, that.secondary)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(primary)
                .append(secondary)
                .toHashCode();
    }

    public static class Builder {
        private Table primary;
        private Table secondary;

        public Builder primary(Table primary) {
            this.primary = primary;
            return this;
        }

        public Builder secondary(Table secondary) {
            this.secondary = secondary;
            return this;
        }

        public OneToOneTableRelation build() {
            return new OneToOneTableRelation(primary, secondary);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy