1 /*
2 * SPDX-FileCopyrightText: none
3 * SPDX-License-Identifier: CC0-1.0
4 */
5
6 package dev.metaschema.databind.codegen.config;
7
8 import java.util.List;
9
10 import dev.metaschema.core.model.IModelDefinition;
11 import dev.metaschema.core.model.IModule;
12 import edu.umd.cs.findbugs.annotations.NonNull;
13 import edu.umd.cs.findbugs.annotations.Nullable;
14
15 /**
16 * Provides configuration for Java class binding generation from Metaschema
17 * modules.
18 * <p>
19 * This interface defines how Metaschema module elements are mapped to Java
20 * classes, including package names, class names, base classes, and
21 * superinterfaces.
22 */
23 public interface IBindingConfiguration {
24
25 /**
26 * Generates a Java package name for the provided Module module.
27 *
28 * @param module
29 * the Module module to generate a package name for
30 * @return a Java package name
31 */
32 @NonNull
33 String getPackageNameForModule(@NonNull IModule module);
34
35 /**
36 * Get the Java class name for the provided field or assembly definition.
37 *
38 * @param definition
39 * the definition to generate the Java class name for
40 * @return a Java class name
41 */
42 @NonNull
43 String getClassName(@NonNull IModelDefinition definition);
44
45 /**
46 * Get the Java class name for the provided Module module.
47 *
48 * @param module
49 * the Module module to generate the Java class name for
50 * @return a Java class name
51 */
52 @NonNull
53 String getClassName(@NonNull IModule module);
54
55 /**
56 * Get the Java class name of the base class to use for the class associated
57 * with the provided definition.
58 *
59 * @param definition
60 * a definition that may be built as a class
61 * @return the name of the base class or {@code null} if no base class is to be
62 * used
63 */
64 @Nullable
65 String getQualifiedBaseClassName(@NonNull IModelDefinition definition);
66
67 /**
68 * Get the Java class names of the superinterfaces to use for the class
69 * associated with the provided definition.
70 *
71 * @param definition
72 * a definition that may be built as a class
73 * @return a list of superinterface class names
74 */
75 @NonNull
76 List<String> getQualifiedSuperinterfaceClassNames(@NonNull IModelDefinition definition);
77
78 /**
79 * Retrieve the binding configuration for the provided definition.
80 *
81 * @param definition
82 * the definition to get the configuration for
83 * @return the binding configuration, or {@code null} if there is no
84 * configuration for this definition
85 */
86 @Nullable
87 IDefinitionBindingConfiguration getBindingConfigurationForDefinition(@NonNull IModelDefinition definition);
88 }