mockup_loader
mockup_loader copied to clipboard
Parsing plugins
Idea by Shai Sinai from comments to compiler blogpost. Potential future feature.
Create a possibility to parse certain files specifically e.g. to support excels and not only text. Also possible to use it to support web sources. Current implementation ideas:
- create an interface that takes in raw file content and returns container with data
- possibility to register instances of these interfaces in connection with e.g. file extension
class lcl_my_excel_parser.
interfaces: zif_mockup_loader_plugin.
method zif_mockup_loader_plugin~process.
e_container = my_parse_data( iv_data ). " xtsring to table
endmethod.
...
lo_ml->register_plugin( i_ext = '*.xlsx' io_handler = new lcl_my_excel_parser ).
questions:
- how to handle complex internal structure universally ? e.g. excel has sheets ? Either transparent path -
load( 'DIRECTORY/my_custom_data.xlsx/excel_sheet_name' ), or kind of hash query in JS -load( 'DIRECTORY/my_custom_data.xlsx#some-query-specific-to-plugin?param=12345' ) - how to pass mockup loader internal parameters to the plugin. E.g. encoding, amount, date formats ... parameters - there might be too many, they may change in future. Probably a table of name-value strings would be better.