com.kenshoo.pl.entity.Entity 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;
import java.util.List;
import static java.util.Collections.emptyList;
public interface Entity {
boolean containsField(EntityField, ?> field);
T get(EntityField, T> field);
/**
* @param field the field whose value should be fetched
* @param the type of value in the field
* @return the field value if not null
; or Triptional.nullInstance()
if null
; or Triptional.absent()
if the field doesn't exist
*/
default Triptional safeGet(final EntityField, T> field) {
if (containsField(field)) {
return Triptional.of(get(field));
}
return Triptional.absent();
}
default > List> getMany(E type) {
return emptyList();
}
}