Class ExportEntityVisitor<T extends TopiaEntityEnum>
java.lang.Object
org.nuiton.topia.persistence.csv.out.ExportEntityVisitor<T>
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,EntityVisitor
public class ExportEntityVisitor<T extends TopiaEntityEnum> extends java.lang.Object implements EntityVisitor, java.io.Closeable
Entity visitor to export data to csv files.
- Since:
- 2.6.12
- Author:
- tchemit <chemit@codelutin.com>
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<T,TopiaCsvExports.EntityExportContext<T>>entityExportersExport for simple entity.protected TopiaPersistenceHelper<T>persistenceHelperstatic org.nuiton.util.TimeLogTIME_LOG -
Constructor Summary
Constructors Constructor Description ExportEntityVisitor(TopiaPersistenceHelper<T> persistenceHelper, java.util.Map<T,TopiaCsvExports.EntityExportContext<T>> entityExporters) -
Method Summary
Modifier and Type Method Description voidclear()Reset all states of the visitor.voidclose()voidend(TopiaEntity entity)Ends the visit of the given entity.<E extends TopiaEntity>
voidexport(java.lang.Iterable<E> entities)voidexport(TopiaEntity entity)protected TopiaCsvExports.EntityExportContextgetEntityContext(java.lang.Class<? extends TopiaEntity> entityType)static <T extends TopiaEntityEnum>
ExportEntityVisitor<T>newVisitor(TopiaPersistenceHelper<T> persistenceHelper, java.util.Map<T,TopiaCsvExports.EntityExportContext<T>> entityExporters)voidstart(TopiaEntity entity)Start the visit of the given entity.voidvisit(TopiaEntity entity, java.lang.String propertyName, java.lang.Class<?> collectionType, java.lang.Class<?> type, int index, java.lang.Object value)Visit a indexed value from a collection property for the given entity.voidvisit(TopiaEntity entity, java.lang.String propertyName, java.lang.Class<?> collectionType, java.lang.Class<?> type, java.lang.Object value)Visit a collection property for the given entity.voidvisit(TopiaEntity entity, java.lang.String propertyName, java.lang.Class<?> type, java.lang.Object value)Visit a none indexed property for the given entity.protected voidvisitEntityCollection(TopiaEntity entity, java.lang.String propertyName, java.lang.Class<?> collectionType, java.lang.Class<?> type, java.util.Collection<?> cValue)
-
Field Details
-
TIME_LOG
public static final org.nuiton.util.TimeLog TIME_LOG -
entityExporters
protected final java.util.Map<T extends TopiaEntityEnum,TopiaCsvExports.EntityExportContext<T extends TopiaEntityEnum>> entityExportersExport for simple entity. -
persistenceHelper
-
-
Constructor Details
-
ExportEntityVisitor
public ExportEntityVisitor(TopiaPersistenceHelper<T> persistenceHelper, java.util.Map<T,TopiaCsvExports.EntityExportContext<T>> entityExporters)
-
-
Method Details
-
newVisitor
public static <T extends TopiaEntityEnum> ExportEntityVisitor<T> newVisitor(TopiaPersistenceHelper<T> persistenceHelper, java.util.Map<T,TopiaCsvExports.EntityExportContext<T>> entityExporters) -
export
-
export
-
start
Description copied from interface:EntityVisitorStart the visit of the given entity.- Specified by:
startin interfaceEntityVisitor- Parameters:
entity- the visited entity
-
end
Description copied from interface:EntityVisitorEnds the visit of the given entity.- Specified by:
endin interfaceEntityVisitor- Parameters:
entity- the visited entity
-
visit
public void visit(TopiaEntity entity, java.lang.String propertyName, java.lang.Class<?> type, java.lang.Object value)Description copied from interface:EntityVisitorVisit a none indexed property for the given entity. The property visited is defined by the other parameters.- Specified by:
visitin interfaceEntityVisitor- Parameters:
entity- the visited entitypropertyName- the name of the visited propertytype- the type of the visited propertyvalue- the value of the visited property
-
visit
public void visit(TopiaEntity entity, java.lang.String propertyName, java.lang.Class<?> collectionType, java.lang.Class<?> type, java.lang.Object value)Description copied from interface:EntityVisitorVisit a collection property for the given entity. The property visited is defined by the other parameters.- Specified by:
visitin interfaceEntityVisitor- Parameters:
entity- the visited entitypropertyName- the name of the visited propertycollectionType- the type of the visited collectiontype- the type of the visited propertyvalue- the value of the visited property
-
visitEntityCollection
protected void visitEntityCollection(TopiaEntity entity, java.lang.String propertyName, java.lang.Class<?> collectionType, java.lang.Class<?> type, java.util.Collection<?> cValue) -
visit
public void visit(TopiaEntity entity, java.lang.String propertyName, java.lang.Class<?> collectionType, java.lang.Class<?> type, int index, java.lang.Object value)Description copied from interface:EntityVisitorVisit a indexed value from a collection property for the given entity. The property visited is defined by the other parameters.- Specified by:
visitin interfaceEntityVisitor- Parameters:
entity- the visited entitypropertyName- the name of the visited propertycollectionType- the type of the container of the visited propertytype- the type of the visited propertyindex- the index of the visited property in his containervalue- the value of the visited property
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
clear
public void clear()Description copied from interface:EntityVisitorReset 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:
clearin interfaceEntityVisitor
-
getEntityContext
protected TopiaCsvExports.EntityExportContext getEntityContext(java.lang.Class<? extends TopiaEntity> entityType)
-