Class ExcelCollector<T>

java.lang.Object
pro.verron.officestamper.experimental.ExcelCollector<T>
Type Parameters:
T - the type of objects to collect

public class ExcelCollector<T> extends Object
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

    Constructors
    Constructor
    Description
    Constructs a new ExcelCollector object with the given type.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    before(Object object)
    This method is called before visiting an object in the ExcelCollector class.
    Returns a List containing the collected objects.
    static <T> List<T>
    collect(Object object, Class<T> type)
    Collects objects of a specific type from an Excel file.
    final void
    visit(Object object)
    Visits the given object and performs specific operations based on its type.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ExcelCollector

      public ExcelCollector(Class<T> type)
      Constructs a new ExcelCollector object with the given type.
      Parameters:
      type - the class representing the type of objects to collect
  • Method Details

    • collect

      public static <T> List<T> collect(Object object, Class<T> type)
      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 from
      type - the class representing the type of objects to collect
      Returns:
      a List containing the collected objects
    • collect

      public List<T> collect()
      Returns a List containing the collected objects.
      Returns:
      a List containing the collected objects
    • before

      protected void before(Object object)
      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

      public final void visit(@Nullable Object object)
      Visits the given object and performs specific operations based on its type.
      Parameters:
      object - the object to visit