001/*
002 * SPDX-FileCopyrightText: none
003 * SPDX-License-Identifier: CC0-1.0
004 */
005
006package dev.metaschema.databind.codegen.config;
007
008import java.util.List;
009
010import dev.metaschema.core.model.IModelDefinition;
011import dev.metaschema.core.model.IModule;
012import edu.umd.cs.findbugs.annotations.NonNull;
013import edu.umd.cs.findbugs.annotations.Nullable;
014
015/**
016 * Provides configuration for Java class binding generation from Metaschema
017 * modules.
018 * <p>
019 * This interface defines how Metaschema module elements are mapped to Java
020 * classes, including package names, class names, base classes, and
021 * superinterfaces.
022 */
023public interface IBindingConfiguration {
024
025  /**
026   * Generates a Java package name for the provided Module module.
027   *
028   * @param module
029   *          the Module module to generate a package name for
030   * @return a Java package name
031   */
032  @NonNull
033  String getPackageNameForModule(@NonNull IModule module);
034
035  /**
036   * Get the Java class name for the provided field or assembly definition.
037   *
038   * @param definition
039   *          the definition to generate the Java class name for
040   * @return a Java class name
041   */
042  @NonNull
043  String getClassName(@NonNull IModelDefinition definition);
044
045  /**
046   * Get the Java class name for the provided Module module.
047   *
048   * @param module
049   *          the Module module to generate the Java class name for
050   * @return a Java class name
051   */
052  @NonNull
053  String getClassName(@NonNull IModule module);
054
055  /**
056   * Get the Java class name of the base class to use for the class associated
057   * with the provided definition.
058   *
059   * @param definition
060   *          a definition that may be built as a class
061   * @return the name of the base class or {@code null} if no base class is to be
062   *         used
063   */
064  @Nullable
065  String getQualifiedBaseClassName(@NonNull IModelDefinition definition);
066
067  /**
068   * Get the Java class names of the superinterfaces to use for the class
069   * associated with the provided definition.
070   *
071   * @param definition
072   *          a definition that may be built as a class
073   * @return a list of superinterface class names
074   */
075  @NonNull
076  List<String> getQualifiedSuperinterfaceClassNames(@NonNull IModelDefinition definition);
077
078  /**
079   * Retrieve the binding configuration for the provided definition.
080   *
081   * @param definition
082   *          the definition to get the configuration for
083   * @return the binding configuration, or {@code null} if there is no
084   *         configuration for this definition
085   */
086  @Nullable
087  IDefinitionBindingConfiguration getBindingConfigurationForDefinition(@NonNull IModelDefinition definition);
088}