TYPE
- The Java type that this column should be translated to and from.ENTITY
- The entity this column belongs to.BUILDER
- The class that is used to build new entity instances.public abstract class AbstractColumn<TYPE,ENTITY,BUILDER> extends Object implements Column<ENTITY,BUILDER>
Most users of hrorm will have no need to directly use this.
Modifier and Type | Field and Description |
---|---|
protected Function<ENTITY,TYPE> |
getter |
protected boolean |
nullable |
protected BiConsumer<BUILDER,TYPE> |
setter |
Constructor and Description |
---|
AbstractColumn(String name,
String prefix,
Function<ENTITY,TYPE> getter,
BiConsumer<BUILDER,TYPE> setter,
boolean nullable) |
Modifier and Type | Method and Description |
---|---|
String |
getName()
The name of the database column this instance represents.
|
String |
getPrefix()
The prefix that should be used for this column when generating
SQL.
|
void |
notNull()
Calling this method will enforce a not-null constraint on this column.
|
PopulateResult |
populate(BUILDER builder,
ResultSet resultSet)
Populates the object with the data read from the database.
|
void |
setValue(ENTITY item,
int index,
PreparedStatement preparedStatement)
Sets a value onto the prepared statement based on the state of the object passed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isParentColumn, isPrimaryKey, supportedTypes, withPrefix
protected final BiConsumer<BUILDER,TYPE> setter
protected boolean nullable
public String getName()
Column
public String getPrefix()
Column
public PopulateResult populate(BUILDER builder, ResultSet resultSet) throws SQLException
Column
populate
in interface Column<ENTITY,BUILDER>
builder
- The object being populatedresultSet
- The result said being readSQLException
- allowed for ResultSet
operationspublic void setValue(ENTITY item, int index, PreparedStatement preparedStatement) throws SQLException
Column
setValue
in interface Column<ENTITY,BUILDER>
item
- The object to read the data from.index
- Where in the prepared statement to set the read valuepreparedStatement
- The statement being populatedSQLException
- allowed for PreparedStatement
operationsCopyright © 2019. All rights reserved.