Package org.pipecraft.pipes.utils
Class QueueItem<T>
- java.lang.Object
-
- org.pipecraft.pipes.utils.QueueItem<T>
-
- Type Parameters:
T- The wrapped item type
public class QueueItem<T> extends Object
A wrapper on queue items. To be used withQueueReaderPipeandQueueWriterPipe.- Author:
- Eyal Schneider
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> QueueItem<T>end()static <T> QueueItem<T>error(Throwable e)TgetItem()ThrowablegetThrowable()booleanisEndOfData()booleanisSuccessfulEndOfData()static <T> QueueItem<T>of(T item)
-
-
-
Method Detail
-
of
public static <T> QueueItem<T> of(T item)
- Parameters:
item- The item to wrap- Returns:
- The queue item wrapping the given value
-
error
public static <T> QueueItem<T> error(Throwable e)
- Parameters:
e- The error to wrap- Returns:
- A queue item indicating an abnormal termination with the given error
-
end
public static <T> QueueItem<T> end()
- Returns:
- a queue item indicating successful end of data
-
getItem
public T getItem()
- Returns:
- The item to wrap. Null value serves as an end of data marker (successful if and only if throwable parameter is also null)
-
getThrowable
public Throwable getThrowable()
- Returns:
- An error indicating abnormal end of data. Null when the queue item doesn't indicate an error.
-
isEndOfData
public boolean isEndOfData()
- Returns:
- true if and only if the queue item indicates end of data (either successful or with error)
-
isSuccessfulEndOfData
public boolean isSuccessfulEndOfData()
- Returns:
- true if and only if the queue item indicates a successful end of data
-
-