Class ExportEntityVisitor<T extends TopiaEntityEnum>

java.lang.Object
org.nuiton.topia.persistence.csv.out.ExportEntityVisitor<T>
All Implemented Interfaces:
Closeable, AutoCloseable, EntityVisitor

public class ExportEntityVisitor<T extends TopiaEntityEnum> extends Object implements EntityVisitor, Closeable
Entity visitor to export data to csv files.
Since:
2.6.12
Author:
tchemit <chemit@codelutin.com>
  • Field Details

  • Constructor Details

  • Method Details

    • newVisitor

      public static <T extends TopiaEntityEnum> ExportEntityVisitor<T> newVisitor(TopiaPersistenceHelper<T> persistenceHelper, Map<T,TopiaCsvExports.EntityExportContext<T>> entityExporters)
    • export

      public <E extends TopiaEntity> void export(Iterable<E> entities)
    • export

      public void export(TopiaEntity entity)
    • start

      public void start(TopiaEntity entity)
      Description copied from interface: EntityVisitor
      Start the visit of the given entity.
      Specified by:
      start in interface EntityVisitor
      Parameters:
      entity - the visited entity
    • end

      public void end(TopiaEntity entity)
      Description copied from interface: EntityVisitor
      Ends the visit of the given entity.
      Specified by:
      end in interface EntityVisitor
      Parameters:
      entity - the visited entity
    • visit

      public void visit(TopiaEntity entity, String propertyName, Class<?> type, Object value)
      Description copied from interface: EntityVisitor
      Visit a none indexed property for the given entity. The property visited is defined by the other parameters.
      Specified by:
      visit in interface EntityVisitor
      Parameters:
      entity - the visited entity
      propertyName - the name of the visited property
      type - the type of the visited property
      value - the value of the visited property
    • visit

      public void visit(TopiaEntity entity, String propertyName, Class<?> collectionType, Class<?> type, Object value)
      Description copied from interface: EntityVisitor
      Visit a collection property for the given entity. The property visited is defined by the other parameters.
      Specified by:
      visit in interface EntityVisitor
      Parameters:
      entity - the visited entity
      propertyName - the name of the visited property
      collectionType - the type of the visited collection
      type - the type of the visited property
      value - the value of the visited property
    • visitEntityCollection

      protected void visitEntityCollection(TopiaEntity entity, String propertyName, Class<?> collectionType, Class<?> type, Collection<?> cValue)
    • visit

      public void visit(TopiaEntity entity, String propertyName, Class<?> collectionType, Class<?> type, int index, Object value)
      Description copied from interface: EntityVisitor
      Visit a indexed value from a collection property for the given entity. The property visited is defined by the other parameters.
      Specified by:
      visit in interface EntityVisitor
      Parameters:
      entity - the visited entity
      propertyName - the name of the visited property
      collectionType - the type of the container of the visited property
      type - the type of the visited property
      index - the index of the visited property in his container
      value - the value of the visited property
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • clear

      public void clear()
      Description copied from interface: EntityVisitor
      Reset all states of the visitor. If you use internal states inside the visitor, this method should clean all of them. This method should be invoked after usage of the visitor.
      Specified by:
      clear in interface EntityVisitor
    • getEntityContext

      protected TopiaCsvExports.EntityExportContext getEntityContext(Class<? extends TopiaEntity> entityType)