Package com.kenshoo.pl.entity
Interface EntityFieldDbAdapter<T>
-
- Type Parameters:
T- type of the entity field
- All Known Implementing Classes:
EmptyVirtualEntityFieldDbAdapter,SimpleEntityFieldDbAdapter,VirtualEntityFieldDbAdapter,VirtualEntityFieldDbAdapter2
public interface EntityFieldDbAdapter<T>Handles the transformation of a value for the entity field this adapter is attached to, to the database and vice versa.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.stream.Stream<java.lang.Object>getDbValues(T value)default java.lang.ObjectgetFirstDbValue(T value)default org.jooq.TableField<org.jooq.Record,?>getFirstTableField()TgetFromRecord(java.util.Iterator<java.lang.Object> valuesIterator)Composes the value of the entity field out of values of individual table fields.DataTablegetTable()java.util.stream.Stream<org.jooq.TableField<org.jooq.Record,?>>getTableFields()default booleanisIdentityField()
-
-
-
Method Detail
-
getTable
DataTable getTable()
- Returns:
- the table this entity fields maps to
-
getTableFields
java.util.stream.Stream<org.jooq.TableField<org.jooq.Record,?>> getTableFields()
- Returns:
- the table fields this entity field maps to
-
getFirstTableField
default org.jooq.TableField<org.jooq.Record,?> getFirstTableField()
- Returns:
- the first table field that this entity field maps to
- Throws:
java.lang.IllegalStateException- if there are no fields
-
getDbValues
java.util.stream.Stream<java.lang.Object> getDbValues(T value)
- Parameters:
value- value of entity field to translate- Returns:
- the values for the fields returned by
getTableFields(), in the same order
-
getFirstDbValue
default java.lang.Object getFirstDbValue(T value)
- Parameters:
value- value of entity field to translate- Returns:
- the first value for the fields returned by
getTableFields(), in field order - Throws:
java.lang.IllegalStateException- if there are no fields
-
getFromRecord
T getFromRecord(java.util.Iterator<java.lang.Object> valuesIterator)
Composes the value of the entity field out of values of individual table fields. The iterator passed to this method is positioned at the value of the first field returned bygetTableFields()and the following values correspond to the rest of the fields in the same order.- Parameters:
valuesIterator- iterator positioned at the start of values forgetTableFields()- Returns:
- the value of entity field composed out of DB values taken from the supplied iterator
-
isIdentityField
default boolean isIdentityField()
-
-