public class ColumnMapRowMapper extends ObjectSE implements BiFunctionSE<Row,RowMetadata,MapSE<StringSE,ObjectSE>>
java.util.Map
を作成する Mapping function
SE 実装。すべての列をキーと値のペアとして表します。各列に 1 つのエントリがあり、列名がキーになります。 使用する Map 実装と列 Map の各列に使用するキーは、それぞれ createColumnMap(int)
と getColumnKey(java.lang.String)
をオーバーライドすることでカスタマイズできます。
注意 : デフォルトでは、ColumnMapRowMapper は大文字と小文字を区別しないキーを使用してリンクマップを構築しようとします。これにより、列の順序が保持され、列名に大文字と小文字を使用できるようになります。これには、クラスパス(自動検出される)に Commons コレクションが必要です。それ以外の場合、フォールバックは標準のリンクされた HashMap であり、列の順序は保持されますが、アプリケーションがドライバーによって公開されたのと同じ大文字と小文字で列名を指定する必要があります。
修飾子と型 | フィールドと説明 |
---|---|
static ColumnMapRowMapper | INSTANCE デフォルトの ColumnMapRowMapper インスタンス。 |
コンストラクターと説明 |
---|
ColumnMapRowMapper() |
修飾子と型 | メソッドと説明 |
---|---|
MapSE<StringSE, ObjectSE> | apply(Row row, RowMetadata rowMetadata) |
protected MapSE<StringSE, ObjectSE> | createColumnMap(int columnCount) 列マップとして使用する Map SE インスタンスを作成します。 |
protected StringSE | getColumnKey(StringSE columnName) 列 Map SE の特定の列に使用するキーを決定します。 |
protected ObjectSE | getColumnValue(Row row, int index) 指定された列の R2DBC オブジェクト値を取得します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
andThenSE
public static final ColumnMapRowMapper INSTANCE
ColumnMapRowMapper
インスタンス。public MapSE<StringSE,ObjectSE> apply(Row row, RowMetadata rowMetadata)
BiFunctionSE<Row, RowMetadata, MapSE<StringSE, ObjectSE>>
の applySE
protected MapSE<StringSE,ObjectSE> createColumnMap(int columnCount)
Map
SE インスタンスを作成します。デフォルトでは、リンクされた大文字と小文字を区別しないマップが作成されます。
columnCount
- マップの初期容量として使用される列数 Map
SE インスタンス LinkedCaseInsensitiveMap
protected StringSE getColumnKey(StringSE columnName)
Map
SE の特定の列に使用するキーを決定します。columnName
- Row
によって返される列名 ColumnMetadata.getName()
@Nullable protected ObjectSE getColumnValue(Row row, int index)
デフォルトの実装では、Row.get(int)
メソッドを使用します。
row
- データを保持している Row
です index
- 列インデックスです