com.kenshoo.pl.data.DatabaseId Maven / Gradle / Ivy
                 Go to download
                
        
                    Show more of this group  Show more artifacts with this name
Show all versions of persistence-layer Show documentation
                Show all versions of persistence-layer Show documentation
A Java persistence layer based on JOOQ for high performance and business flow support.
                
             The newest version!
        
        package com.kenshoo.pl.data;
import org.apache.commons.lang3.ArrayUtils;
import org.jooq.TableField;
import java.util.Arrays;
public class DatabaseId {
    private final TableField, ?>[] tableFields;
    private final Object[] values;
    private int hashCode;
    public DatabaseId(TableField, ?>[] tableFields, Object[] values) {
        this.values = values;
        this.tableFields = tableFields;
    }
    public DatabaseId append(DatabaseId other) {
        return new DatabaseId(
                ArrayUtils.addAll(this.tableFields, other.tableFields),
                ArrayUtils.addAll(this.values, other.values)
        );
    }
    public Object[] getValues() {
        return values;
    }
    public static  DatabaseId create(TableField, T> tableField, T val) {
        return new SingleDBId<>(tableField, val);
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof DatabaseId)) return false;
        DatabaseId that = (DatabaseId) o;
        // Probably incorrect - comparing Object[] arrays with Arrays.equals
        return Arrays.deepEquals(values, that.values);
    }
    @Override
    public int hashCode() {
        if (hashCode == 0) {
            hashCode = Arrays.deepHashCode(values);
        }
        return hashCode;
    }
    public TableField, ?>[] getTableFields() {
        return tableFields;
    }
}
     © 2015 - 2025 Weber Informatics LLC | Privacy Policy