Class JsonExporter

All Implemented Interfaces:
TableExporter

@Component("grdexp_JsonExporter") @Scope("prototype") public class JsonExporter extends AbstractTableExporter<JsonExporter>
Use this class to export Table into JSON format.
Just create an instance of ExportAction with withExporter method.
  • Field Details

    • metadata

      protected Metadata metadata
    • gsonConfigurer

      protected Function<com.google.gson.GsonBuilder,com.google.gson.GsonBuilder> gsonConfigurer
  • Constructor Details

  • Method Details

    • withGsonConfigurator

      public JsonExporter withGsonConfigurator(Function<com.google.gson.GsonBuilder,com.google.gson.GsonBuilder> gsonConfigurator)
      Configure Gson builder for export
      Parameters:
      gsonConfigurator - Gson configurator function
      Returns:
      exporter instance
    • exportTable

      public void exportTable(Downloader downloader, Table<Object> table, ExportMode exportMode)
      Description copied from interface: TableExporter
      download table content via downloader
    • exportDataGrid

      public void exportDataGrid(Downloader downloader, DataGrid<Object> dataGrid, ExportMode exportMode)
      Description copied from interface: TableExporter
      download dataGrid content via downloader
    • createJsonObjectFromEntity

      protected com.google.gson.JsonObject createJsonObjectFromEntity(DataGrid<Object> dataGrid, Object entity)
    • createJsonObjectFromEntity

      protected com.google.gson.JsonObject createJsonObjectFromEntity(Table<Object> table, Object entity)
    • createGsonForSerialization

      protected com.google.gson.Gson createGsonForSerialization()
    • getItems

      protected Collection<Object> getItems(Table<Object> table, ExportMode exportMode)
    • getItems

      protected Collection<Object> getItems(DataGrid<Object> dataGrid, ExportMode exportMode)
    • getCaption

      public String getCaption()
      Description copied from interface: TableExporter
      returns exporter caption