Class EntityExporter
java.lang.Object
cz.zcu.fav.kiv.mjakubas.saf.io.export.EntityExporter
Class handles entity exports from/to file.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Export entities to file.static void
exportAsJSON
(@NotNull Object[] entities, @NotNull String path) static void
exportAsXML
(@NotNull Object[] entities, @NotNull String path) static Object[]
importToObjects
(@NotNull FileType fileType, @NotNull String path, Class<?> entityClass) Imports entities from file as object.static Object[]
importToObjectsFromJSON
(@NotNull String path, @NotNull Class<?> entityClass) static Object[]
importToObjectsFromXML
(@NotNull String path, @NotNull Class<?> entityClass)
-
Constructor Details
-
EntityExporter
public EntityExporter()
-
-
Method Details
-
export
public static void export(@NotNull @NotNull Object[] entities, @NotNull @NotNull FileType fileType, @NotNull @NotNull String path) throws ExportException Export entities to file.- Parameters:
entities
- entitiesfileType
- filetypepath
- path- Throws:
ExportException
- if any exception happens.
-
exportAsJSON
public static void exportAsJSON(@NotNull @NotNull Object[] entities, @NotNull @NotNull String path) throws ExportException - Throws:
ExportException
-
exportAsXML
public static void exportAsXML(@NotNull @NotNull Object[] entities, @NotNull @NotNull String path) throws ExportException - Throws:
ExportException
-
importToObjects
public static Object[] importToObjects(@NotNull @NotNull FileType fileType, @NotNull @NotNull String path, Class<?> entityClass) throws ExportException Imports entities from file as object.- Parameters:
fileType
- filetypepath
- pathentityClass
- entities class- Returns:
- entities as objects
- Throws:
ExportException
- if any exception happens
-
importToObjectsFromXML
public static Object[] importToObjectsFromXML(@NotNull @NotNull String path, @NotNull @NotNull Class<?> entityClass) throws ExportException - Throws:
ExportException
-
importToObjectsFromJSON
public static Object[] importToObjectsFromJSON(@NotNull @NotNull String path, @NotNull @NotNull Class<?> entityClass) throws ExportException - Throws:
ExportException
-