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<Long,Long,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 |
---|---|
GenericColumn<Long> |
asGenericColumn()
Returns a generic column instance that supports the underlying
DBTYPE |
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 passed builder object with the data read from the database.
|
void |
setSqlTypeName(String sqlTypeName)
Set the name of the type of this column as it would be in the SQL schema.
|
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. |
Long |
toClassType(Long dbType)
Applies any
Converter associated with this column to
a raw database type. |
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
fromResultSet, 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
public String getJoinedTablePrefix()
public String getPrefix()
Column
public PopulateResult populate(ENTITYBUILDER builder, ResultSet resultSet) throws SQLException
Column
populate
in interface Column<Long,Long,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<Long,Long,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<Long,Long,ENTITY,ENTITYBUILDER>
newPrefix
- The new prefixprefixer
- The source for new prefixespublic List<Column<?,?,JOINED,JOINEDBUILDER>> getNonJoinColumns()
public void notNull()
Column
public String getJoinedTablePrimaryKeyName()
public Set<Integer> supportedTypes()
Column
java.sql.Types
that this column should support.supportedTypes
in interface Column<Long,Long,ENTITY,ENTITYBUILDER>
public boolean isNullable()
Column
isNullable
in interface Column<Long,Long,ENTITY,ENTITYBUILDER>
public String getSqlTypeName()
Column
String
,
"decimal" for BigDecimal
.getSqlTypeName
in interface Column<Long,Long,ENTITY,ENTITYBUILDER>
public void setSqlTypeName(String sqlTypeName)
Column
setSqlTypeName
in interface Column<Long,Long,ENTITY,ENTITYBUILDER>
sqlTypeName
- The name of the SQL type.public Long toClassType(Long dbType)
Column
Converter
associated with this column to
a raw database type.toClassType
in interface Column<Long,Long,ENTITY,ENTITYBUILDER>
dbType
- The value of an element represented by this column, as
stored in the database, or at least, as represented in the
JDBC.ENTITY
class.public GenericColumn<Long> asGenericColumn()
Column
DBTYPE
asGenericColumn
in interface Column<Long,Long,ENTITY,ENTITYBUILDER>
Copyright © 2019. All rights reserved.