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

com.kenshoo.pl.entity.internal.EntityFieldImpl 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;

import com.kenshoo.pl.entity.EntityField;
import com.kenshoo.pl.entity.EntityFieldDbAdapter;
import com.kenshoo.pl.entity.EntityType;
import com.kenshoo.pl.entity.ValueConverter;
import com.kenshoo.pl.entity.equalityfunctions.EntityValueEqualityFunction;

public class EntityFieldImpl, T> implements EntityField {

    private final EntityType entityType;

    private final EntityFieldDbAdapter dbAdapter;

    private final EntityValueEqualityFunction valueEqualityFunction;

    private final ValueConverter stringValueConverter;

    public EntityFieldImpl(EntityType entityType, EntityFieldDbAdapter dbAdapter, ValueConverter stringValueConverter, EntityValueEqualityFunction valueEqualityFunction) {
        this.entityType = entityType;
        this.dbAdapter = dbAdapter;
        this.valueEqualityFunction = valueEqualityFunction;
        this.stringValueConverter = stringValueConverter;
    }

    @Override
    public EntityFieldDbAdapter getDbAdapter() {
        return dbAdapter;
    }

    @Override
    public ValueConverter getStringValueConverter() {
        return stringValueConverter;
    }

    @Override
    public boolean valuesEqual(T v1, T v2) {
        return valueEqualityFunction.apply(v1, v2);
    }

    @Override
    public EntityType getEntityType() {
        return entityType;
    }

    @Override
    public String toString() {
        return entityType.toFieldName(this);
    }

    @Override
    @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
    public boolean equals(Object o) {
        return (this == o);
    }

    @Override
    public int hashCode() {
        return System.identityHashCode(this);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy