Class Parser


  • public class Parser
    extends Object
    Provides a simple parsing service that extracts DDL from a Room-generated JSON schema file. This class is not a Java application (i.e. it does not provide an entry point main method), but is suitable for consumption by many different types of applications or plugins.

    The JSON schema produced by Room is structured as shown below. Property values, properties that are not read by this implementation, and repeated properties in arrays are indicated by "..." placeholders.

    
     {
       "database": {
         "version": ...,
         "entities": [
           {
             "tableName": "...",
             "createSql": "...",
             indices: [
               {
                 "name": "...",
                 "createSql": "...",
                 ...
               },
               ...
             ],
             ...
           },
           ...
         ],
         "views": [
           {
             "viewName": "...",
             "createSql": "..."
           },
           ...
         ],
       },
       ...
     }
     

    In general, the SQL fragments in the values of the createSql properties have placeholder tokens referencing the name of the relevant table or view for each. The Entity, Index, and View data-transfer object (DTO) classes replace these placeholders in their implementations of the Streamable.stream() methods.

    • Constructor Detail

      • Parser

        public Parser()
        Initializes this instance. Currently, since this class has no mutable state, nor even any final fields set on instance initialization, this constructor does nothing.