001/* 002 * SPDX-FileCopyrightText: none 003 * SPDX-License-Identifier: CC0-1.0 004 */ 005 006package gov.nist.secauto.metaschema.databind.codegen; 007 008import gov.nist.secauto.metaschema.core.model.IModule; 009import gov.nist.secauto.metaschema.core.util.ObjectUtils; 010import gov.nist.secauto.metaschema.databind.model.IBoundModule; 011 012import java.util.Collection; 013 014import edu.umd.cs.findbugs.annotations.NonNull; 015 016/** 017 * Provides information about a generated Java class that represents a Module 018 * module. 019 */ 020public interface IGeneratedModuleClass extends IGeneratedClass { 021 022 /** 023 * Get the associated Module module data. 024 * 025 * @return the module data 026 */ 027 @NonNull 028 IModule getModule(); 029 030 /** 031 * Get the Java package name associated with the Module module. 032 * 033 * @return the package name 034 */ 035 @NonNull 036 String getPackageName(); 037 038 /** 039 * Get the collection of generated classes representing definitions associated 040 * with the Module module. 041 * 042 * @return the collection of definition classes 043 */ 044 @NonNull 045 Collection<IGeneratedDefinitionClass> getGeneratedDefinitionClasses(); 046 047 /** 048 * Dynamicly load this class. 049 * 050 * @param classLoader 051 * the class loader to use to load this class 052 * @return the module class 053 * @throws ClassNotFoundException 054 * if this classwas not found 055 * @since 2.0.0 056 */ 057 @SuppressWarnings("unchecked") 058 @NonNull 059 default Class<? extends IBoundModule> load(@NonNull ClassLoader classLoader) throws ClassNotFoundException { 060 return ObjectUtils.notNull((Class<? extends IBoundModule>) classLoader.loadClass(getClassName().reflectionName())); 061 } 062}