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