类 Chunk<W>
- java.lang.Object
- org.springframework.batch.core.step.item.Chunk<W>
- 所有已实现的接口:
java.lang.Iterable<W>
public class Chunk<W> extends java.lang.Object implements java.lang.Iterable<W>
Encapsulation of a list of items to be processed and possibly a list of failed items to be skipped. To mark an item as skipped clients should iterate over the chunk using theiterator()
method, and if there is a failure callChunk.ChunkIterator.remove()
on the iterator. The skipped items are then available through the chunk.- 从以下版本开始:
- 2.0
- 作者:
- Dave Syer
嵌套类概要
嵌套类 修饰符和类型 类 说明 class
Chunk.ChunkIterator
Special iterator for a chunk providing theChunk.ChunkIterator.remove(Throwable)
method for dynamically removing an item and adding it to the skips.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
add(W item)
Add the item to the chunk.void
clear()
Clear the items down to signal that we are done.void
clearSkips()
Clear only the skips list.java.util.List<java.lang.Exception>
getErrors()
java.util.List<W>
getItems()
java.util.List<SkipWrapper<W>>
getSkips()
java.lang.Object
getUserData()
boolean
isBusy()
Query the chunk to see if anyone has registered an interest in keeping a reference to it.boolean
isEmpty()
boolean
isEnd()
Flag to indicate if the source data is exhausted.Chunk.ChunkIterator
iterator()
Get an unmodifiable iterator for the underlying items.void
setBusy(boolean busy)
Register an interest in the chunk to prevent it from being cleaned up before the flag is reset to false.void
setEnd()
Set the flag to say that this chunk represents an end of stream (there is no more data to process).void
setUserData(java.lang.Object userData)
int
size()
void
skip(java.lang.Exception e)
Register an anonymous skip.java.lang.String
toString()
方法详细资料
clear
public void clear()
Clear the items down to signal that we are done.
getItems
public java.util.List<W> getItems()
- 返回:
- a copy of the items to be processed as an unmodifiable list
getSkips
public java.util.List<SkipWrapper<W>> getSkips()
- 返回:
- a copy of the skips as an unmodifiable list
getErrors
public java.util.List<java.lang.Exception> getErrors()
- 返回:
- a copy of the anonymous errors as an unmodifiable list
skip
public void skip(java.lang.Exception e)
Register an anonymous skip. To skip an individual item, useChunk.ChunkIterator.remove()
.- 参数:
e
- the exception that caused the skip
isEmpty
public boolean isEmpty()
- 返回:
- true if there are no items in the chunk
iterator
public Chunk.ChunkIterator iterator()
Get an unmodifiable iterator for the underlying items.- 指定者:
iterator
在接口中java.lang.Iterable<W>
- 另请参阅:
Iterable.iterator()
size
public int size()
- 返回:
- the number of items (excluding skips)
isEnd
public boolean isEnd()
Flag to indicate if the source data is exhausted.- 返回:
- true if there is no more data to process
setEnd
public void setEnd()
Set the flag to say that this chunk represents an end of stream (there is no more data to process).
isBusy
public boolean isBusy()
Query the chunk to see if anyone has registered an interest in keeping a reference to it.- 返回:
- the busy flag
setBusy
public void setBusy(boolean busy)
Register an interest in the chunk to prevent it from being cleaned up before the flag is reset to false.- 参数:
busy
- the flag to set
clearSkips
public void clearSkips()
Clear only the skips list.
getUserData
public java.lang.Object getUserData()
setUserData
public void setUserData(java.lang.Object userData)
toString
public java.lang.String toString()
- 覆盖:
toString
在类中java.lang.Object