1 /*
2 * SPDX-FileCopyrightText: none
3 * SPDX-License-Identifier: CC0-1.0
4 */
5
6 package dev.metaschema.databind.codegen;
7
8 import java.util.Collection;
9
10 import dev.metaschema.core.model.IModule;
11 import dev.metaschema.core.util.ObjectUtils;
12 import dev.metaschema.databind.model.IBoundModule;
13 import edu.umd.cs.findbugs.annotations.NonNull;
14
15 /**
16 * Provides information about a generated Java class that represents a Module
17 * module.
18 */
19 public interface IGeneratedModuleClass extends IGeneratedClass {
20
21 /**
22 * Get the associated Module module data.
23 *
24 * @return the module data
25 */
26 @NonNull
27 IModule getModule();
28
29 /**
30 * Get the Java package name associated with the Module module.
31 *
32 * @return the package name
33 */
34 @NonNull
35 String getPackageName();
36
37 /**
38 * Get the collection of generated classes representing definitions associated
39 * with the Module module.
40 *
41 * @return the collection of definition classes
42 */
43 @NonNull
44 Collection<IGeneratedDefinitionClass> getGeneratedDefinitionClasses();
45
46 /**
47 * Dynamicly load this class.
48 *
49 * @param classLoader
50 * the class loader to use to load this class
51 * @return the module class
52 * @throws ClassNotFoundException
53 * if this classwas not found
54 * @since 2.0.0
55 */
56 @SuppressWarnings("unchecked")
57 @NonNull
58 default Class<? extends IBoundModule> load(@NonNull ClassLoader classLoader) throws ClassNotFoundException {
59 return ObjectUtils.notNull((Class<? extends IBoundModule>) classLoader.loadClass(getClassName().reflectionName()));
60 }
61 }