public class ExportEntityVisitor<T extends TopiaEntityEnum> extends Object implements EntityVisitor, Closeable
Modifier and Type | Field and Description |
---|---|
protected Map<T,TopiaCsvExports.EntityExportContext<T>> |
entityExporters
Export for simple entity.
|
protected TopiaPersistenceHelper<T> |
persistenceHelper |
static org.nuiton.util.TimeLog |
TIME_LOG |
Constructor and Description |
---|
ExportEntityVisitor(TopiaPersistenceHelper<T> persistenceHelper,
Map<T,TopiaCsvExports.EntityExportContext<T>> entityExporters) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Reset all states of the visitor.
|
void |
close() |
void |
end(TopiaEntity entity)
Ends the visit of the given entity.
|
<E extends TopiaEntity> |
export(Iterable<E> entities) |
void |
export(TopiaEntity entity) |
protected TopiaCsvExports.EntityExportContext |
getEntityContext(Class<? extends TopiaEntity> entityType) |
static <T extends TopiaEntityEnum> |
newVisitor(TopiaPersistenceHelper<T> persistenceHelper,
Map<T,TopiaCsvExports.EntityExportContext<T>> entityExporters) |
void |
start(TopiaEntity entity)
Start the visit of the given entity.
|
void |
visit(TopiaEntity entity,
String propertyName,
Class<?> collectionType,
Class<?> type,
int index,
Object value)
Visit a indexed value from a collection property for the given entity.
|
void |
visit(TopiaEntity entity,
String propertyName,
Class<?> collectionType,
Class<?> type,
Object value)
Visit a collection property for the given entity.
|
void |
visit(TopiaEntity entity,
String propertyName,
Class<?> type,
Object value)
Visit a none indexed property for the given entity.
|
protected void |
visitEntityCollection(TopiaEntity entity,
String propertyName,
Class<?> collectionType,
Class<?> type,
Collection<?> cValue) |
public static final org.nuiton.util.TimeLog TIME_LOG
protected final Map<T extends TopiaEntityEnum,TopiaCsvExports.EntityExportContext<T extends TopiaEntityEnum>> entityExporters
protected final TopiaPersistenceHelper<T extends TopiaEntityEnum> persistenceHelper
public ExportEntityVisitor(TopiaPersistenceHelper<T> persistenceHelper, Map<T,TopiaCsvExports.EntityExportContext<T>> entityExporters)
public static <T extends TopiaEntityEnum> ExportEntityVisitor<T> newVisitor(TopiaPersistenceHelper<T> persistenceHelper, Map<T,TopiaCsvExports.EntityExportContext<T>> entityExporters)
public <E extends TopiaEntity> void export(Iterable<E> entities)
public void export(TopiaEntity entity)
public void start(TopiaEntity entity)
EntityVisitor
start
in interface EntityVisitor
entity
- the visited entitypublic void end(TopiaEntity entity)
EntityVisitor
end
in interface EntityVisitor
entity
- the visited entitypublic void visit(TopiaEntity entity, String propertyName, Class<?> type, Object value)
EntityVisitor
visit
in interface EntityVisitor
entity
- the visited entitypropertyName
- the name of the visited propertytype
- the type of the visited propertyvalue
- the value of the visited propertypublic void visit(TopiaEntity entity, String propertyName, Class<?> collectionType, Class<?> type, Object value)
EntityVisitor
visit
in interface EntityVisitor
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 propertyprotected void visitEntityCollection(TopiaEntity entity, String propertyName, Class<?> collectionType, Class<?> type, Collection<?> cValue)
public void visit(TopiaEntity entity, String propertyName, Class<?> collectionType, Class<?> type, int index, Object value)
EntityVisitor
visit
in interface EntityVisitor
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 propertypublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void clear()
EntityVisitor
clear
in interface EntityVisitor
protected TopiaCsvExports.EntityExportContext getEntityContext(Class<? extends TopiaEntity> entityType)
Copyright © 2004–2022 Code Lutin. All rights reserved.