パッケージ org.nkjmlab.sorm4j

クラス SormFactory


  • public final class SormFactory
    extends Object
    Main entry point of this library. It creates Sorm object.
    作成者:
    nkjm
    • フィールドの詳細

    • メソッドの詳細

      • create

        public static Sorm create​(DataSource dataSource)
        Create a Sorm object which uses DataSource.
        パラメータ:
        dataSource -
        戻り値:
      • create

        public static Sorm create​(DataSource dataSource,
                                  String configName)
        Create a Sorm object which uses DataSource and the configurations corresponding to the given configName.
        パラメータ:
        dataSource -
        configName -
        戻り値:
      • create

        public static Sorm create​(String jdbcUrl,
                                  String username,
                                  String password,
                                  String configName)
        Create a Sorm object which uses DriverManager and the configurations corresponding to the given configName.
        パラメータ:
        jdbcUrl -
        username -
        password -
        configName -
        戻り値:
      • getConfigString

        public static String getConfigString​(String configName)
        Gets the string of the config of the given config name. DEFAULT_CONFIG_NAME is default config name.
        パラメータ:
        configName -
        戻り値:
      • registerConfig

        public static void registerConfig​(String configName,
                                          Consumer<Configurator> configuratorConsumer)
        Registers configuration under the given name.
        パラメータ:
        configName -
        configuratorConsumer -
      • registerModifiedConfig

        public static void registerModifiedConfig​(String srcConfigName,
                                                  String newConfigName,
                                                  Consumer<Configurator> configuratorConsumer)
        Registers modified configuration of the given Sorm object under the given name.
        パラメータ:
        srcConfigName -
        newConfigName -
        configuratorConsumer -
      • resetDefaultConfig

        public static void resetDefaultConfig()
      • toOrmConnection

        public static OrmConnection toOrmConnection​(Connection connection)
        Create a OrmConnection wrapping the given JDBC Connection
        パラメータ:
        connection -
        戻り値:
      • toOrmConnection

        public static <T> TypedOrmConnection<T> toOrmConnection​(Connection conn,
                                                                Class<T> objectClass)
        Create a TypedOrmConnection wrapping the given JDBC Connection.
        型パラメータ:
        T -
        パラメータ:
        conn -
        objectClass -
        戻り値:
      • toOrmConnection

        public static <T> TypedOrmConnection<T> toOrmConnection​(Connection conn,
                                                                Class<T> objectClass,
                                                                String configName)
        Create a TypedOrmConnection wrapping the given JDBC Connection with the specified configurations
        型パラメータ:
        T -
        パラメータ:
        conn -
        objectClass -
        configName -
        戻り値:
      • toOrmConnection

        public static OrmConnection toOrmConnection​(Connection connection,
                                                    String configName)
        Create a OrmConnection wrapping the given JDBC Connection with the specified configurations
        パラメータ:
        connection -
        configName -
        戻り値:
      • updateDefaultConfig

        public static void updateDefaultConfig​(Consumer<Configurator> configuratorConsumer)
        Updates default configuration. This updates does not effect existing Sorm objects.
        パラメータ:
        configuratorConsumer -