Class XMLDataFactory

java.lang.Object
io.odysz.module.xtable.XMLDataFactory

public class XMLDataFactory extends Object
Factory of flat xml data.
Is this not necessary? Or a generic flat xml data factory is needed?
Author:
Odys
  • Field Details

  • Constructor Details

    • XMLDataFactory

      public XMLDataFactory()
  • Method Details

    • getXMLData

      protected static XMLFlatData getXMLData(String dataName, InputStream istream, IXMLStruct xmlStruct, boolean forceReload)
    • buildTable

      public static XMLTable buildTable(String sourceID, ILogger androidLogger, String newTableID, String fromStructureOfTableID, ArrayList<String[]> fromList, String targetFullpath, IXMLStruct xmlStruct)
      Construct a new table.
      Copy data structure from 'fromTableID', copy data from 'fromList'
      Parameters:
      sourceID -
      androidLogger -
      newTableID -
      fromStructureOfTableID -
      fromList -
      targetFullpath -
      xmlStruct -
      Returns:
      new xml table
    • getTable

      public static XMLTable getTable(ILogger logger, String tableID, String fromFullpath, IXMLStruct xmlStruct)
      Usage ex.:
      InputStream istr = res.getAssets().open(configName + ".xml");
      IXMLStruct xmlStruct = new IXMLStruct() {
      @Override public String rootTag() { return "xtables"; }
      @Override public String tableTag() { return "table"; }
      @Override public String recordTag() { return "record"; }
      };
      ILogger logger = new Logger();
      skintable = XMLDataFactory.getTable(logger, configTablename, istr, xmlStruct);
      Parameters:
      logger -
      tableID -
      fromFullpath -
      xmlStruct -
      Returns:
      target table
    • getTable

      public static XMLTable getTable(String sourceID, ILogger androidLogger, String tableID, String fromFullpath, IXMLStruct xmlStruct)
    • getTable

      public static XMLTable getTable(ILogger androidLogger, String tableID, InputStream istream, IXMLStruct xmlStruct)
      Parameters:
      androidLogger -
      tableID -
      istream -
      xmlStruct -
      Returns:
      target table
      See Also:
    • getTableReusing

      public static XMLTable getTableReusing(String sourceID, ILogger androidLogger, String tableID, IXMLStruct xmlStruct)
      Get a table, don't reload. This is for caller avoiding reopen file repeatedly.
      Parameters:
      sourceID -
      androidLogger -
      tableID -
      xmlStruct -
      Returns:
      xml table
    • getTable

      public static XMLTable getTable(String sourceID, ILogger androidLogger, String tableID, InputStream istream, IXMLStruct xmlStruct)
    • getTable

      public static XMLTable getTable(String sourceID, ILogger androidLogger, String tableID, InputStream istream, IXMLStruct xmlStruct, boolean reload)
    • getTable

      public static XMLTable getTable(String sourceID, ILogger androidLogger, String tableID, String fromFullpath, IXMLStruct xmlStruct, boolean reload)
    • writeTables

      public static void writeTables(IXMLStruct xmlStrct, String fullpath, XMLTable[] tables) throws Exception
      Throws:
      Exception
    • getLogger

      protected static ILogger getLogger() throws Exception
      Throws:
      Exception