Class EnumValueInterfaceUtils

    • Method Detail

      • setupInPreprocessOpenAPI

        public static String setupInPreprocessOpenAPI​(Map<String,​String> importMapping,
                                                      Map<String,​Object> additionalProperties,
                                                      List<SupportingFile> supportingFiles,
                                                      String sourceFolder,
                                                      String configPackage,
                                                      String mustacheTemplate,
                                                      String outputFileName)
        Registers the ValuedEnum supporting file and import mapping.

        Must be called from preprocessOpenAPI when useEnumValueInterface is enabled. Returns the simple class name derived from the (possibly custom) import mapping, which the caller must store and pass to injectInPostProcessModelsEnum(org.openapitools.codegen.model.ModelsMap, java.lang.String, java.lang.String, java.lang.String) later.

        Parameters:
        importMapping - the codegen's import-mapping map (mutated in place)
        additionalProperties - the codegen's additional-properties map (mutated in place)
        supportingFiles - the codegen's supporting-files list (mutated in place)
        sourceFolder - language source folder (e.g. "src/main/java")
        configPackage - the config package where the interface is generated (e.g. "org.openapitools.configuration")
        mustacheTemplate - template name (e.g. "enumValueInterface.mustache")
        outputFileName - generated file name (e.g. "ValuedEnum.java")
        Returns:
        the simple class name of ValuedEnum (accounts for custom import mappings)
      • injectInPostProcessModelsEnum

        public static void injectInPostProcessModelsEnum​(ModelsMap objs,
                                                         String valuedEnumClassName,
                                                         String valuedEnumFqn,
                                                         String xImplementsExtensionKey)
        Injects ValuedEnum<T> into the implements vendor extension of every enum in the given model batch.

        Must be called from postProcessModelsEnum when useEnumValueInterface is enabled. Handles both top-level enum schemas and inline enum properties.

        Parameters:
        objs - the model batch being post-processed
        valuedEnumClassName - simple class name (e.g. "ValuedEnum")
        valuedEnumFqn - fully-qualified name used for the import statement
        xImplementsExtensionKey - vendor-extension key that carries the implements list ("x-implements" for Java, "x-kotlin-implements" for Kotlin)