ENTITY
- the entity this column belongs toJOINED
- the entity being joinedENTITYBUILDER
- the class that can construct new entity instancesJOINEDBUILDER
- the class that can construct instances of the joined entitypublic class JoinColumn<ENTITY,JOINED,ENTITYBUILDER,JOINEDBUILDER> extends Object implements Column<ENTITY,ENTITYBUILDER>
Most users of hrorm will have no need to directly use this.
Constructor and Description |
---|
JoinColumn(String name,
String joinedTablePrefix,
Prefixer prefixer,
Function<ENTITY,JOINED> getter,
BiConsumer<ENTITYBUILDER,JOINED> setter,
DaoDescriptor<JOINED,JOINEDBUILDER> daoDescriptor,
boolean nullable) |
Modifier and Type | Method and Description |
---|---|
String |
getJoinedTablePrefix() |
String |
getJoinedTablePrimaryKeyName() |
String |
getName()
The name of the database column this instance represents.
|
List<Column<JOINED,JOINEDBUILDER>> |
getNonJoinColumns() |
String |
getPrefix()
The prefix that should be used for this column when generating
SQL.
|
String |
getSqlTypeName()
Returns the name of the column type in SQL, e.g.
|
String |
getTable() |
List<JoinColumn<JOINED,?,JOINEDBUILDER,?>> |
getTransitiveJoins() |
boolean |
isNullable()
Indicator of whether or not this column is nullable or not.
|
void |
notNull()
Calling this method will enforce a not-null constraint on this column.
|
PopulateResult |
populate(ENTITYBUILDER builder,
ResultSet resultSet)
Populates the object with the data read from the database.
|
void |
setSqlTypeName(String sqlTypeName) |
void |
setValue(ENTITY 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. |
JoinColumn<ENTITY,JOINED,ENTITYBUILDER,JOINEDBUILDER> |
withPrefix(String newPrefix,
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, wait
isParentColumn, isPrimaryKey
public JoinColumn(String name, String joinedTablePrefix, Prefixer prefixer, Function<ENTITY,JOINED> getter, BiConsumer<ENTITYBUILDER,JOINED> setter, DaoDescriptor<JOINED,JOINEDBUILDER> daoDescriptor, boolean nullable)
public List<JoinColumn<JOINED,?,JOINEDBUILDER,?>> getTransitiveJoins()
public String getTable()
public String getName()
Column
getName
in interface Column<ENTITY,ENTITYBUILDER>
public String getJoinedTablePrefix()
public String getPrefix()
Column
getPrefix
in interface Column<ENTITY,ENTITYBUILDER>
public PopulateResult populate(ENTITYBUILDER builder, ResultSet resultSet) throws SQLException
Column
populate
in interface Column<ENTITY,ENTITYBUILDER>
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,ENTITYBUILDER>
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 JoinColumn<ENTITY,JOINED,ENTITYBUILDER,JOINEDBUILDER> withPrefix(String newPrefix, Prefixer prefixer)
Column
withPrefix
in interface Column<ENTITY,ENTITYBUILDER>
newPrefix
- The new prefixprefixer
- The source for new prefixespublic List<Column<JOINED,JOINEDBUILDER>> getNonJoinColumns()
public void notNull()
Column
notNull
in interface Column<ENTITY,ENTITYBUILDER>
public String getJoinedTablePrimaryKeyName()
public Set<Integer> supportedTypes()
Column
java.sql.Types
that this column should support.supportedTypes
in interface Column<ENTITY,ENTITYBUILDER>
public boolean isNullable()
Column
isNullable
in interface Column<ENTITY,ENTITYBUILDER>
public String getSqlTypeName()
Column
String
,
"decimal" for BigDecimal
.getSqlTypeName
in interface Column<ENTITY,ENTITYBUILDER>
public void setSqlTypeName(String sqlTypeName)
setSqlTypeName
in interface Column<ENTITY,ENTITYBUILDER>
Copyright © 2019. All rights reserved.