public class PrimaryKeyImpl<T> extends Object implements PrimaryKey<T>
| Constructor and Description | 
|---|
| PrimaryKeyImpl(String name,
              String prefix,
              Function<T,Long> getter,
              BiConsumer<T,Long> setter,
              String sequenceName) | 
| Modifier and Type | Method and Description | 
|---|---|
| Long | getKey(T item)Extracts the primary key | 
| String | getName() | 
| String | getPrefix() | 
| String | getSequenceName()The name of the database sequence that is used to populate this key | 
| boolean | isPrimaryKey() | 
| void | populate(T item,
        ResultSet resultSet)Populates the object with the data read from the database. | 
| void | setKey(T item,
      Long id)Sets the key onto the object | 
| void | setValue(T item,
        int index,
        PreparedStatement preparedStatement)Sets a value onto the prepared statement based on the state of the object passed. | 
| TypedColumn<T> | withPrefix(String prefix)Make a new instance of the column, identical to this instance, except with a
 new prefix. | 
public Long getKey(T item)
PrimaryKeygetKey in interface PrimaryKey<T>item - The object whose key is to be extractedpublic String getSequenceName()
PrimaryKeygetSequenceName in interface PrimaryKey<T>public void setKey(T item, Long id)
PrimaryKeysetKey in interface PrimaryKey<T>item - the object whose key is to be setid - the primary key to assign itpublic TypedColumn<T> withPrefix(String prefix)
TypedColumnwithPrefix in interface TypedColumn<T>prefix - The new prefixpublic String getName()
getName in interface TypedColumn<T>public String getPrefix()
getPrefix in interface TypedColumn<T>public void populate(T item, ResultSet resultSet) throws SQLException
TypedColumnpopulate in interface TypedColumn<T>item - The object being populatedresultSet - The result said being readSQLException - allowed for ResultSet operationspublic void setValue(T item, int index, PreparedStatement preparedStatement) throws SQLException
TypedColumnsetValue in interface TypedColumn<T>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 boolean isPrimaryKey()
isPrimaryKey in interface TypedColumn<T>Copyright © 2018. All rights reserved.