パッケージ org.nkjmlab.sorm4j
インタフェース Sorm
-
public interface SormAn interface of executing object-relation mapping.- 作成者:
- nkjm
-
-
メソッドの概要
すべてのメソッド インスタンス・メソッド abstractメソッド 修飾子とタイプ メソッド 説明 <T> voidaccept(Class<T> objectClass, ConsumerHandler<TypedOrmConnection<T>> handler)Accepts aTypedOrmConnectionhandler for a task with object-relation mapping.voidaccept(ConsumerHandler<OrmConnection> handler)Accepts aOrmConnectionhandler for a task with object-relation mapping.voidacceptJdbcConnectionHandler(ConsumerHandler<Connection> handler)Accepts aConnectionhandler for a task with object-relation mapping.<T> voidacceptTransactionHandler(Class<T> objectClass, ConsumerHandler<TypedOrmTransaction<T>> handler)Accepts aTypedOrmTransactionhandler for a task with object-relation mapping.voidacceptTransactionHandler(ConsumerHandler<OrmTransaction> handler)Accepts aOrmTransactionhandler for a task with object-relation mapping.<T,R>
Rapply(Class<T> objectClass, FunctionHandler<TypedOrmConnection<T>,R> handler)Applies aTypedOrmConnectionhandler for a task with object-relation mapping and gets the result.<R> Rapply(FunctionHandler<OrmConnection,R> handler)Applies aOrmConnectionhandler for a task with object-relation mapping and gets the result.<R> RapplyJdbcConnectionHandler(FunctionHandler<Connection,R> handler)Applies aConnectionhandler for a task with object-relation mapping and gets the result.<T,R>
RapplyTransactionHandler(Class<T> objectClass, FunctionHandler<TypedOrmTransaction<T>,R> handler)Applies aTypedOrmTransactionhandler for a task with object-relation mapping and gets the result.<R> RapplyTransactionHandler(FunctionHandler<OrmTransaction,R> handler)Applies aOrmTransactionhandler for a task with object-relation mapping and gets the result.SormcreateWith(String configName)Creates a Sorm object with the given config name.StringgetConfigName()Get the config name of this object.StringgetConfigString()Get the string of the config of this object.DataSourcegetDataSource()GetsDataSource.ConnectiongetJdbcConnection()Gets JDBCConnection.Map<String,String>getTableMappingStatusMap()Gets map of the table mapping status.OrmConnectionopenConnection()OpenOrmConnection.<T> TypedOrmConnection<T>openConnection(Class<T> objectClass)OpenTypedOrmConnection.OrmTransactionopenTransaction()OpenOrmTransaction.<T> TypedOrmTransaction<T>openTransaction(Class<T> objectClass)OpenTypedOrmTransaction.
-
-
-
メソッドの詳細
-
accept
<T> void accept(Class<T> objectClass, ConsumerHandler<TypedOrmConnection<T>> handler)
Accepts aTypedOrmConnectionhandler for a task with object-relation mapping. The connection will be closed after the process of handler.- 型パラメータ:
T-- パラメータ:
objectClass-handler-
-
accept
void accept(ConsumerHandler<OrmConnection> handler)
Accepts aOrmConnectionhandler for a task with object-relation mapping. The connection will be closed after the process of handler.- パラメータ:
handler-
-
acceptJdbcConnectionHandler
void acceptJdbcConnectionHandler(ConsumerHandler<Connection> handler)
Accepts aConnectionhandler for a task with object-relation mapping. The connection will be closed after the process of handler.- パラメータ:
handler-
-
acceptTransactionHandler
<T> void acceptTransactionHandler(Class<T> objectClass, ConsumerHandler<TypedOrmTransaction<T>> handler)
Accepts aTypedOrmTransactionhandler for a task with object-relation mapping. The transaction will be closed after the process of handler. The transaction will be committed and the connection will be closed after the process of handler. When the transaction throws a exception, the transaction will be rollback.- 型パラメータ:
T-- パラメータ:
objectClass-handler-
-
acceptTransactionHandler
void acceptTransactionHandler(ConsumerHandler<OrmTransaction> handler)
Accepts aOrmTransactionhandler for a task with object-relation mapping. The transaction will be committed and the connection will be closed after the process of handler. When the transaction throws a exception, the transaction will be rollback.- パラメータ:
handler-
-
apply
<T,R> R apply(Class<T> objectClass, FunctionHandler<TypedOrmConnection<T>,R> handler)
Applies aTypedOrmConnectionhandler for a task with object-relation mapping and gets the result. The connection will be closed after the process of handler.- 型パラメータ:
T-R-- パラメータ:
objectClass-handler-- 戻り値:
-
apply
<R> R apply(FunctionHandler<OrmConnection,R> handler)
Applies aOrmConnectionhandler for a task with object-relation mapping and gets the result. The connection will be closed after the process of handler.- 型パラメータ:
R-- パラメータ:
handler-- 戻り値:
-
applyJdbcConnectionHandler
<R> R applyJdbcConnectionHandler(FunctionHandler<Connection,R> handler)
Applies aConnectionhandler for a task with object-relation mapping and gets the result. The connection will be closed after the process of handler.- 型パラメータ:
R-- パラメータ:
handler-- 戻り値:
-
applyTransactionHandler
<T,R> R applyTransactionHandler(Class<T> objectClass, FunctionHandler<TypedOrmTransaction<T>,R> handler)
Applies aTypedOrmTransactionhandler for a task with object-relation mapping and gets the result. The transaction will be committed and the connection will be closed after the process of handler. When the transaction throws a exception, the transaction will be rollback.- 型パラメータ:
T-R-- パラメータ:
objectClass-handler-- 戻り値:
-
applyTransactionHandler
<R> R applyTransactionHandler(FunctionHandler<OrmTransaction,R> handler)
Applies aOrmTransactionhandler for a task with object-relation mapping and gets the result. The transaction will be committed and the connection will be closed after the process of handler. When the transaction throws a exception, the transaction will be rollback.- 型パラメータ:
R-- パラメータ:
handler-- 戻り値:
-
createWith
Sorm createWith(String configName)
Creates a Sorm object with the given config name. The config name should be registered bySormFactory.registerConfig(String, java.util.function.Consumer)orSormFactory.registerModifiedConfig(String, String, java.util.function.Consumer)- パラメータ:
configName-- 戻り値:
-
getConfigName
String getConfigName()
Get the config name of this object.- 戻り値:
-
getConfigString
String getConfigString()
Get the string of the config of this object.- 戻り値:
-
getDataSource
DataSource getDataSource()
GetsDataSource.- 戻り値:
-
getJdbcConnection
Connection getJdbcConnection()
Gets JDBCConnection.- 戻り値:
-
getTableMappingStatusMap
Map<String,String> getTableMappingStatusMap()
Gets map of the table mapping status. The keys are table names in lower case.- 戻り値:
-
openConnection
OrmConnection openConnection()
OpenOrmConnection. You should always use try-with-resources to ensure the database connection is released. We recommend usingaccept(ConsumerHandler)orapply(FunctionHandler).- 戻り値:
-
openConnection
<T> TypedOrmConnection<T> openConnection(Class<T> objectClass)
OpenTypedOrmConnection. You should always use try-with-resources to ensure the database connection is released. We recommend usingaccept(Class, ConsumerHandler)orapply(Class, FunctionHandler).- 戻り値:
-
openTransaction
OrmTransaction openTransaction()
OpenOrmTransaction. You should always use try-with-resources to ensure the database connection is released. We recommend usingacceptTransactionHandler(ConsumerHandler)orapplyTransactionHandler(FunctionHandler). Default transaction level isConnection.TRANSACTION_READ_COMMITTED. Note: the transaction is automatically rollback if the transaction is not committed.- 戻り値:
-
openTransaction
<T> TypedOrmTransaction<T> openTransaction(Class<T> objectClass)
OpenTypedOrmTransaction. You should always use try-with-resources to ensure the database connection is released. We recommend usingacceptTransactionHandler(Class, ConsumerHandler)orapplyTransactionHandler(Class, FunctionHandler). Default transaction level isConnection.TRANSACTION_READ_COMMITTED. Note: the transaction is automatically rollback if the transaction is not committed.- 型パラメータ:
T-- パラメータ:
objectClass-- 戻り値:
-
-