Class AbstractAdaCodegen

    • Constructor Detail

      • AbstractAdaCodegen

        public AbstractAdaCodegen()
    • Method Detail

      • toAdaIdentifier

        protected String toAdaIdentifier​(String name,
                                         String prefix)
        Turn a parameter name, operation name into an Ada identifier. Ada programming standard avoid the camelcase syntax and prefer the underscore notation. We also have to make sure the identifier is not a reserved keyword. When this happens, we add the configurable prefix. The function translates: body - P_Body petId - Pet_Id updatePetWithForm - Update_Pet_With_Form
        Parameters:
        name - the parameter name.
        prefix - the optional prefix in case the parameter name is a reserved keyword.
        Returns:
        the Ada identifier to be used.
      • toOperationId

        public String toOperationId​(String operationId)
        Description copied from class: DefaultCodegen
        Return the operation ID (method name)
        Overrides:
        toOperationId in class DefaultCodegen
        Parameters:
        operationId - operation ID
        Returns:
        the sanitized method name
      • toVarName

        public String toVarName​(String name)
        Description copied from class: DefaultCodegen
        Return the variable name by removing invalid characters and proper escaping if it's a reserved word.
        Overrides:
        toVarName in class DefaultCodegen
        Parameters:
        name - the variable name
        Returns:
        the sanitized variable name
      • toParamName

        public String toParamName​(String name)
        Description copied from class: DefaultCodegen
        Return the parameter name by removing invalid characters and proper escaping if it's a reserved word.
        Specified by:
        toParamName in interface CodegenConfig
        Overrides:
        toParamName in class DefaultCodegen
        Parameters:
        name - Codegen property object
        Returns:
        the sanitized parameter name
      • toModelName

        public String toModelName​(String name)
        Output the proper model name (capitalized). In case the name belongs to the TypeSystem it won't be renamed.
        Specified by:
        toModelName in interface CodegenConfig
        Overrides:
        toModelName in class DefaultCodegen
        Parameters:
        name - the name of the model
        Returns:
        capitalized model name
      • fromProperty

        public CodegenProperty fromProperty​(String name,
                                            io.swagger.models.properties.Property p)
        Description copied from class: DefaultCodegen
        Convert Swagger Property object to Codegen Property object
        Overrides:
        fromProperty in class DefaultCodegen
        Parameters:
        name - name of the property
        p - Swagger property object
        Returns:
        Codegen Property object
      • escapeReservedWord

        public String escapeReservedWord​(String name)
        Escapes a reserved word as defined in the `reservedWords` array. Handle escaping those terms here. This logic is only called if a variable matches the reserved words
        Specified by:
        escapeReservedWord in interface CodegenConfig
        Overrides:
        escapeReservedWord in class DefaultCodegen
        Parameters:
        name - the name to be escaped
        Returns:
        the escaped term
      • processCompiler

        public com.samskivert.mustache.Mustache.Compiler processCompiler​(com.samskivert.mustache.Mustache.Compiler compiler)
        Override the Mustache compiler configuration. We don't want to have special characters escaped
        Specified by:
        processCompiler in interface CodegenConfig
        Overrides:
        processCompiler in class DefaultCodegen
        Parameters:
        compiler - the compiler.
        Returns:
        the compiler to use.
      • getTypeDeclaration

        public String getTypeDeclaration​(io.swagger.models.properties.Property p)
        Optional - type declaration. This is a String which is used by the templates to instantiate your types. There is typically special handling for different property types
        Specified by:
        getTypeDeclaration in interface CodegenConfig
        Overrides:
        getTypeDeclaration in class DefaultCodegen
        Parameters:
        p - Swagger Property object
        Returns:
        a string value used as the `dataType` field for model templates, `returnType` for api templates
      • postProcessParameter

        public void postProcessParameter​(CodegenParameter parameter)
        Overrides postProcessParameter to add a vendor extension "x-is-model-type". This boolean indicates that the parameter comes from the model package.
        Specified by:
        postProcessParameter in interface CodegenConfig
        Overrides:
        postProcessParameter in class DefaultCodegen
        Parameters:
        parameter - CodegenParameter object to be processed.
      • postProcessMediaTypes

        protected int postProcessMediaTypes​(List<Map<String,​String>> types)
        Post process the media types (produces and consumes) for Ada code generator. For each media type, add a adaMediaType member that gives the Ada enum constant for the corresponding type.
        Parameters:
        types - the list of media types.
        Returns:
        the number of media types.
      • fromOperation

        public CodegenOperation fromOperation​(String path,
                                              String httpMethod,
                                              io.swagger.models.Operation operation,
                                              Map<String,​io.swagger.models.Model> definitions,
                                              io.swagger.models.Swagger swagger)
        Description copied from class: DefaultCodegen
        Convert Swagger Operation object to Codegen Operation object
        Specified by:
        fromOperation in interface CodegenConfig
        Overrides:
        fromOperation in class DefaultCodegen
        Parameters:
        path - the path of the operation
        httpMethod - HTTP method
        operation - Swagger operation object
        definitions - a map of Swagger models
        swagger - a Swagger object representing the spec
        Returns:
        Codegen Operation object