Intuitive DSL for Java

Version 2.0.0 · src/main/java/ch/dbalabs/intuitivedsl/annotation/DslCommand.java

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

DslCommand.java

/*
 * This file is part of the Intuitive DSL project.
 * Copyright (c) 2026 DBA Labs - Switzerland. All rights reserved.
 *
 * This program is dual-licensed under a commercial license and the AGPLv3.
 * For commercial licensing, contact us at [email protected] or visit https://www.dbalabs.ch.
 *
 * AGPLv3 licensing:
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, version 3 (19 November 2007).
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
 */

package ch.dbalabs.intuitivedsl.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Primary annotation used to register a class as an executable command
 * within the Intuitive DSL engine.
 * <p>
 * Classes annotated with {@code @DslCommand} will be parsed at startup
 * to build an in-memory Abstract Syntax Tree (AST) representing their specific grammar.
 * </p>
 *
 * @author DBA Labs
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface DslCommand {

    /**
     * The logical name of the command.
     * * @return the command name (e.g., "SHOW COMMAND HISTORY")
     */
    String name();

    /**
     * The formal syntax (iBNF - intuitive Backus-Naur Form) that describes
     * how this command should be entered by the user.
     * <p>
     * It is highly recommended to use Java Text Blocks ({@code """}) for
     * multiline and readable grammar definitions.
     * </p>
     * * @return the iBNF syntax string
     */
    String syntax();
}