Package io.odysz.module.xtable
Class XMLDataFactory
java.lang.Object
io.odysz.module.xtable.XMLDataFactory
Factory of flat xml data.
Is this not necessary? Or a generic flat xml data factory is needed?
- Author:
- Odys
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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'protected static ILogger
static XMLTable
getTable
(ILogger androidLogger, String tableID, InputStream istream, IXMLStruct xmlStruct) 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);static XMLTable
getTable
(String sourceID, ILogger androidLogger, String tableID, InputStream istream, IXMLStruct xmlStruct) static XMLTable
getTable
(String sourceID, ILogger androidLogger, String tableID, InputStream istream, IXMLStruct xmlStruct, boolean reload) static XMLTable
getTable
(String sourceID, ILogger androidLogger, String tableID, String fromFullpath, IXMLStruct xmlStruct) static XMLTable
getTable
(String sourceID, ILogger androidLogger, String tableID, String fromFullpath, IXMLStruct xmlStruct, boolean reload) static XMLTable
getTableReusing
(String sourceID, ILogger androidLogger, String tableID, IXMLStruct xmlStruct) Get a table, don't reload.protected static XMLFlatData
getXMLData
(String dataName, InputStream istream, IXMLStruct xmlStruct, boolean forceReload) static void
writeTables
(IXMLStruct xmlStrct, String fullpath, XMLTable[] tables)
-
Field Details
-
xmldata
-
-
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
-
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
-
writeTables
public static void writeTables(IXMLStruct xmlStrct, String fullpath, XMLTable[] tables) throws Exception - Throws:
Exception
-
getLogger
- Throws:
Exception
-