All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openapitools.codegen.model.ModelMap Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
package org.openapitools.codegen.model;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.openapitools.codegen.CodegenModel;

public class ModelMap extends HashMap {

    public ModelMap() {

    }

    public ModelMap(Map init) {
        putAll(init);
    }

    public void setModel(CodegenModel model) {
        put("model", model);
    }

    public CodegenModel getModel() {
        return (CodegenModel) get("model");
    }

    /**
     * Convert a list of ModelMap to map of CodegenModel.
     *
     * @param  allModels list of model map
     * @return           map of Codegen Model
     */
    static public HashMap toCodegenModelMap(List allModels) {
        HashMap modelMaps = new HashMap<>();

        for (ModelMap modelMap : allModels) {
            CodegenModel m = modelMap.getModel();
            modelMaps.put(m.classname, m);
        }

        return modelMaps;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy