AdditionalClearingInfo.java

package com.tradecloud.domain.shipment.clearing;

import com.tradecloud.common.base.PersistenceBase;
import com.tradecloud.domain.configuration.clearing.za.PermitType;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import java.util.Objects;

@Entity
public class AdditionalClearingInfo extends PersistenceBase {
    private String reference;

    @Enumerated(EnumType.STRING)
    private PermitType type;

    public AdditionalClearingInfo() {
    }

    public AdditionalClearingInfo(String reference, PermitType type) {
        this.reference = reference;
        this.type = type;
    }

    public String getReference() {
        return reference;
    }

    public void setReference(String reference) {
        this.reference = reference;
    }

    public PermitType getType() {
        return type;
    }

    public void setType(PermitType type) {
        this.type = type;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        AdditionalClearingInfo info = (AdditionalClearingInfo) o;
        return Objects.equals(reference, info.reference) && type == info.type;
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), reference, type);
    }
}