Intuitive DSL for Java

Version 2.1.0 · examples/05-enterprise-command-grammar/README.md

Git clone
git clone https://www.dbalabs.ch/git/intuitive-dsl-java.git

README.md

05 - Enterprise Command Grammar

This example demonstrates how Intuitive DSL scales to handle complex, real-world "Enterprise" grammars.

It combines multiple concepts (mandatory arguments, exclusive choices, optional groups, and boolean flags) into a single, highly readable command structure.

What is covered

  • Complex Grammar Design: Structuring a long command realistically.
    PROVISION DATABASE db_name ENGINE { POSTGRES | MYSQL | ORACLE } [ VERSION db_version ] [ REPLICAS replica_count ] [ ENCRYPTED ] ;
  • Handling Mutually Exclusive Flags: Using multiple @OnClause annotations to determine which engine the user selected.
  • Default Values in Java: Handling omitted optional blocks [ ] cleanly by checking for null in the run() method and applying default business logic.

Running the Example

From your IDE

Execute the main method in EnterpriseGrammarApp.java.

From the command line

Navigate to this directory (05-enterprise-command-grammar) and run:

mvn clean compile exec:java