Package org.jeasy.batch.core.record
Class Batch<P>
- java.lang.Object
-
- org.jeasy.batch.core.record.Batch<P>
-
- Type Parameters:
P
- type of the record's payload
- All Implemented Interfaces:
java.lang.Iterable<Record<P>>
public class Batch<P> extends java.lang.Object implements java.lang.Iterable<Record<P>>
Class representing a batch of records.- Author:
- Mahmoud Ben Hassine ([email protected])
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRecord(Record<P> record)
Add a record to the batch.boolean
equals(java.lang.Object o)
int
hashCode()
boolean
isEmpty()
Check if the batch is empty.java.util.Iterator<Record<P>>
iterator()
void
removeRecord(Record<P> record)
Remove a record from the batch.long
size()
Get the size of the batch.java.lang.String
toString()
-
-
-
Method Detail
-
addRecord
public void addRecord(Record<P> record)
Add a record to the batch.- Parameters:
record
- to add
-
removeRecord
public void removeRecord(Record<P> record)
Remove a record from the batch.- Parameters:
record
- to remove
-
isEmpty
public boolean isEmpty()
Check if the batch is empty.- Returns:
- true if the batch is empty, false otherwise
-
size
public long size()
Get the size of the batch.- Returns:
- the size of the batch
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
iterator
public java.util.Iterator<Record<P>> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<P>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-