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 |
---|---|
GenericColumn<Long> |
asGenericColumn()
Returns a generic column instance that supports the underlying
DBTYPE |
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.
|
String |
getSqlTypeName()
Returns the name of the column type in SQL, e.g.
|
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(CHILDBUILDER item,
ResultSet resultSet)
Populates the passed builder object with the data read from the database.
|
void |
setParentPrimaryKey(PrimaryKey<PARENT,PARENTBUILDER> parentPrimaryKey) |
void |
setSqlTypeName(String sqlTypeName)
Set the name of the type of this column as it would be in the SQL schema.
|
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. |
Long |
toClassType(Long value)
Applies any
Converter associated with this column to
a raw database type. |
Column<Long,Long,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, wait
isParentColumn
fromResultSet, isPrimaryKey
public 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()
Column
public String getPrefix()
Column
public PopulateResult populate(CHILDBUILDER item, ResultSet resultSet)
Column
public void setValue(CHILD item, int index, PreparedStatement preparedStatement)
Column
public Column<Long,Long,CHILD,CHILDBUILDER> withPrefix(String prefix, Prefixer prefixer)
Column
withPrefix
in interface Column<Long,Long,CHILD,CHILDBUILDER>
prefix
- The new prefixprefixer
- The source for new prefixespublic void notNull()
Column
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()
Column
java.sql.Types
that this column should support.supportedTypes
in interface Column<Long,Long,CHILD,CHILDBUILDER>
public Long getParentId(CHILD child)
getParentId
in interface ParentColumn<CHILD,PARENT,CHILDBUILDER,PARENTBUILDER>
public boolean isNullable()
Column
isNullable
in interface Column<Long,Long,CHILD,CHILDBUILDER>
public String getSqlTypeName()
Column
String
,
"decimal" for BigDecimal
.getSqlTypeName
in interface Column<Long,Long,CHILD,CHILDBUILDER>
public void setSqlTypeName(String sqlTypeName)
Column
setSqlTypeName
in interface Column<Long,Long,CHILD,CHILDBUILDER>
sqlTypeName
- The name of the SQL type.public Long toClassType(Long value)
Column
Converter
associated with this column to
a raw database type.toClassType
in interface Column<Long,Long,CHILD,CHILDBUILDER>
value
- 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,CHILD,CHILDBUILDER>
Copyright © 2019. All rights reserved.