001/*
002 * Copyright (c) 2009 The openGion Project.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
013 * either express or implied. See the License for the specific language
014 * governing permissions and limitations under the License.
015 */
016package org.opengion.hayabusa.db;
017
018/**
019 * カラム名配列や、値配列が設定される都度呼び出される リスナーインターフェースです。
020 *
021 * これは、org.opengion.hayabusa.io.TableReader 等で、テーブルの読み取り処理を
022 * 行う都度呼び出されるリスナーとして使用できます。
023 *
024 * 想定として、adjustColumns(読取元ファイルのデータ変換を行う) や、
025 * checkColumns(読取元ファイルの整合性チェックを行う) 、nullCheck(NULL チェックすべきカラム列)
026 * や、DirectTableInsertTag 等で、直接DB登録を行ったりするのを、外部から設定できます。
027 *
028 * @og.rev 6.2.1.0 (2015/03/13) ColumnActionListener 新規作成
029 * @og.group データ処理
030 *
031 * @version  6.2
032 * @author   Kazuhiko Hasegawa
033 * @since    JDK8.0,
034 */
035public interface ColumnActionListener {
036
037        /**
038         * 初期値を設定します。
039         *
040         * これは、通常インナークラスとして直接定義されるため、内部変数を使用して
041         * 処理することになりますが、final定義された変数しか使えません。
042         * そこで、コンストラクタ作成後、実行直前にパラメータを渡すことで、動的な
043         * 処理を行えるようにするための初期値設定です。
044         * Object配列(可変長引数)にしているのは、内部処理するに当たり、どのような
045         * 引数でも渡せるようにしているためで、あまりよろしくない手法です(^^)。
046         *
047         * @og.rev 6.2.1.0 (2015/03/13) ColumnActionListener 新規作成
048         *
049         * @param obj Object配列(可変長引数)
050         */
051        default void init( Object... obj ) {
052                // interface の初期メソッド
053        }
054
055        /**
056         * 一連の作業終了時に呼ばれます。
057         *
058         * これは、#init( Object... ) 設定したり、内部で作成したオブジェクトを
059         * 終了処理させるためのメソッドです。
060         * close 等の処理を行います。
061         * try ~ finally の finally で呼び出せば、必ず終了処理が実施されます。
062         *
063         * @og.rev 6.2.2.0 (2015/03/27) ColumnActionListener 対応。
064         * @og.rev 6.3.6.1 (2015/08/28) 引数は取らない様に変更します。
065         */
066        default void end() {
067                // interface の初期メソッド
068        }
069
070        /**
071         * カラム名の配列が設定された場合に、呼び出されます。
072         *
073         * @og.rev 6.2.1.0 (2015/03/13) ColumnActionListener 新規作成
074         *
075         * @param names カラム名配列
076         */
077        void columnNames( final String[] names );
078
079        /**
080         * #NAME のオリジナルカラム名配列がそろった段階で、イベントが発生します。
081         *
082         * @og.rev 7.3.1.3 (2021/03/09) #NAMEのオリジナルを取得できるようにします。
083         *
084         * @param names カラム名配列
085         */
086        void originalNames( final String[] names );
087
088        /**
089         * 1行分のデータが設定された場合に、呼び出されます。
090         *
091         * @og.rev 6.2.1.0 (2015/03/13) ColumnActionListener 新規作成
092         *
093         * @param   vals    文字列値の1行分の配列
094         * @param   rowNo   行番号(0~)
095         */
096        void values( final String[] vals, final int rowNo );
097
098        /**
099         * 新しくEXCELのシートを処理する際に、シート名をセットするときに呼び出されます。
100         *
101         * @og.rev 7.3.1.1 (2021/02/25) 現在実行中のシート名をセットする
102         *
103         * @param   sheetName   現在実行中のシート名
104         */
105        default void shtName( String sheetName ) {
106                // interface の初期メソッド
107        }
108}