CHILD - The child entity typePARENT - The parent entity typeCHILDBUILDER - The class used to construct new CHILD instancesPARENTBUILDER - The class used to construct new PARENT instancespublic class ParentColumnImpl<CHILD,PARENT,CHILDBUILDER,PARENTBUILDER> extends Object implements ParentColumn<CHILD,PARENT,CHILDBUILDER,PARENTBUILDER>
Most users of hrorm will have no need to directly use this.
| Constructor and Description |
|---|
ParentColumnImpl(String name,
String prefix,
Function<CHILD,PARENT> getter,
BiConsumer<CHILDBUILDER,PARENT> setter) |
ParentColumnImpl(String name,
String prefix,
Function<CHILD,PARENT> getter,
BiConsumer<CHILDBUILDER,PARENT> setter,
PrimaryKey<PARENT,PARENTBUILDER> parentPrimaryKey,
boolean nullable) |
| Modifier and Type | Method and Description |
|---|---|
String |
getName()
The name of the database column this instance represents.
|
Long |
getParentId(CHILD child) |
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(CHILDBUILDER item,
ResultSet resultSet)
Populates the object with the data read from the database.
|
void |
setParentPrimaryKey(PrimaryKey<PARENT,PARENTBUILDER> parentPrimaryKey) |
BiConsumer<CHILDBUILDER,PARENT> |
setter() |
void |
setValue(CHILD item,
int index,
PreparedStatement preparedStatement)
Sets a value onto the prepared statement based on the state of the object passed.
|
Set<Integer> |
supportedTypes()
The members of
java.sql.Types that this column should support. |
Column<CHILD,CHILDBUILDER> |
withPrefix(String prefix,
Prefixer prefixer)
Make a new instance of the column, identical to this instance, except with a
new prefix.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisParentColumnisPrimaryKeypublic ParentColumnImpl(String name, String prefix, Function<CHILD,PARENT> getter, BiConsumer<CHILDBUILDER,PARENT> setter)
public ParentColumnImpl(String name, String prefix, Function<CHILD,PARENT> getter, BiConsumer<CHILDBUILDER,PARENT> setter, PrimaryKey<PARENT,PARENTBUILDER> parentPrimaryKey, boolean nullable)
public String getName()
ColumngetName in interface Column<CHILD,CHILDBUILDER>public String getPrefix()
ColumngetPrefix in interface Column<CHILD,CHILDBUILDER>public PopulateResult populate(CHILDBUILDER item, ResultSet resultSet)
Columnpopulate in interface Column<CHILD,CHILDBUILDER>item - The object being populatedresultSet - The result said being readpublic void setValue(CHILD item, int index, PreparedStatement preparedStatement) throws SQLException
ColumnsetValue in interface Column<CHILD,CHILDBUILDER>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 operationspublic Column<CHILD,CHILDBUILDER> withPrefix(String prefix, Prefixer prefixer)
ColumnwithPrefix in interface Column<CHILD,CHILDBUILDER>prefix - The new prefixprefixer - The source for new prefixespublic void notNull()
ColumnnotNull in interface Column<CHILD,CHILDBUILDER>public BiConsumer<CHILDBUILDER,PARENT> setter()
setter in interface ParentColumn<CHILD,PARENT,CHILDBUILDER,PARENTBUILDER>public void setParentPrimaryKey(PrimaryKey<PARENT,PARENTBUILDER> parentPrimaryKey)
setParentPrimaryKey in interface ParentColumn<CHILD,PARENT,CHILDBUILDER,PARENTBUILDER>public Set<Integer> supportedTypes()
Columnjava.sql.Types that this column should support.supportedTypes in interface Column<CHILD,CHILDBUILDER>public Long getParentId(CHILD child)
getParentId in interface ParentColumn<CHILD,PARENT,CHILDBUILDER,PARENTBUILDER>Copyright © 2019. All rights reserved.