public class MultiResourceItemReader<T> extends AbstractItemStreamItemReader<T>
setResources(Resource[])
によって指定され、実際の読み取りは setDelegate(ResourceAwareItemReaderItemStream)
に委譲されます。入力リソースは setComparator(Comparator)
を使用して順序付けされ、再始動シナリオでのジョブ実行間でリソースの順序が保持されるようにします。コンストラクターと説明 |
---|
MultiResourceItemReader() |
修飾子と型 | メソッドと説明 |
---|---|
void | close() setDelegate(ResourceAwareItemReaderItemStream) リーダーを閉じて、インスタンス変数値をリセットします。 |
org.springframework.core.io.Resource | getCurrentResource() 使用すべきではありません。 代わりに ResourceAware を使用することに賛成です。 |
void | open(ExecutionContext executionContext) 再起動の場合にどのリソースから開始するかを判断し、デリゲートを開いて、リソース内のデリゲートの位置を復元します。 |
T | read() 次の項目を読み取り、必要に応じて次のリソースにジャンプします。 |
void | setComparator(java.util.Comparator<org.springframework.core.io.Resource> comparator) |
void | setDelegate(ResourceAwareItemReaderItemStream<? extends T> delegate) |
void | setResources(org.springframework.core.io.Resource[] resources) |
void | setSaveState(boolean saveState) 更新する ItemStream 呼び出し中に、提供された ExecutionContext に状態を保存する必要があるかどうかを示すブール値を設定します。 |
void | setStrict(boolean strict) 厳密モードでは、読み取るリソースがない場合、リーダーは open(org.springframework.batch.item.ExecutionContext) で例外をスローします。 |
void | update(ExecutionContext executionContext) 現在のリソースインデックスと位置をリソースに保存します。 |
getExecutionContextKey, setExecutionContextName, setName
public void setStrict(boolean strict)
open(org.springframework.batch.item.ExecutionContext)
で例外をスローします。strict
- デフォルトでは false@Nullable public T read() throws java.lang.Exception, UnexpectedInputException, ParseException
null
ParseException
- 現在のレコードの解析に問題がある場合 (しかし、次のものはまだ有効かもしれません)NonTransientResourceException
- 基礎となるリソースに致命的な例外がある場合。この例外をスローした後、実装は後続の read 呼び出しから null を返すように努める必要があります。UnexpectedInputException
- 入力データに未分類の問題がある場合。潜在的に一時的であると想定します。後続の読み取り呼び出しは成功する可能性があります。java.lang.Exception
- 特定のエラーがない場合。public void close() throws ItemStreamException
setDelegate(ResourceAwareItemReaderItemStream)
リーダーを閉じて、インスタンス変数値をリセットします。ItemStream
の close
ItemStreamSupport
の close
ItemStreamException
ItemStream.close()
public void open(ExecutionContext executionContext) throws ItemStreamException
ItemStream
の open
ItemStreamSupport
の open
executionContext
- 現在のステップの ExecutionContext
再起動時のステップの最後の実行からの executionContext になります。ItemStreamException
ItemStream.open(ExecutionContext)
public void update(ExecutionContext executionContext) throws ItemStreamException
ItemStream
の update
ItemStreamSupport
の update
executionContext
- 更新される ItemStreamException
ItemStream.update(ExecutionContext)
public void setDelegate(ResourceAwareItemReaderItemStream<? extends T> delegate)
delegate
- 単一の Resource
から項目を読み取ります。public void setSaveState(boolean saveState)
ItemStream
呼び出し中に、提供された ExecutionContext
に状態を保存する必要があるかどうかを示すブール値を設定します。saveState
- ExecutionContext を更新する場合は true。False は ExecutionContext を更新しません。public void setComparator(java.util.Comparator<org.springframework.core.io.Resource> comparator)
comparator
- 注入されたリソースの順序付けに使用され、デフォルトでは Resource.getFilename()
値を比較します。public void setResources(org.springframework.core.io.Resource[] resources)
resources
- 入力リソース @Nullable @Deprecated public org.springframework.core.io.Resource getCurrentResource()
ResourceAware
を使用することに賛成です。null
。