Module pro.verron.officestamper
Class ExcelCollector<T>
java.lang.Object
pro.verron.officestamper.experimental.ExcelCollector<T>
- Type Parameters:
T
- the type of objects to collect
The ExcelCollector class is used to collect objects of a specific type from an Excel file.
It extends the ExcelVisitor class and overrides the 'before' method to add the objects of the given type to a list.
-
Constructor Summary
ConstructorDescriptionExcelCollector
(Class<T> type) Constructs a new ExcelCollector object with the given type. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
This method is called before visiting an object in the ExcelCollector class.collect()
Returns a List containing the collected objects.static <T> List
<T> Collects objects of a specific type from an Excel file.final void
Visits the given object and performs specific operations based on its type.
-
Constructor Details
-
ExcelCollector
Constructs a new ExcelCollector object with the given type.- Parameters:
type
- the class representing the type of objects to collect
-
-
Method Details
-
collect
Collects objects of a specific type from an Excel file.- Type Parameters:
T
- the type of objects to collect- Parameters:
object
- the Excel file or object to collect fromtype
- the class representing the type of objects to collect- Returns:
- a List containing the collected objects
-
collect
Returns a List containing the collected objects.- Returns:
- a List containing the collected objects
-
before
This method is called before visiting an object in the ExcelCollector class. It checks if the object is an instance of the specified type and adds it to a list if it is.- Parameters:
object
- the object being visited
-
visit
Visits the given object and performs specific operations based on its type.- Parameters:
object
- the object to visit
-