Class AbstractApexCodegen

    • Field Detail

      • serializableModel

        protected Boolean serializableModel
    • Constructor Detail

      • AbstractApexCodegen

        public AbstractApexCodegen()
    • Method Detail

      • 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)
        Description copied from class: DefaultCodegen
        Converts the OpenAPI schema name to a model name suitable for the current code generator. May be overridden for each programming language. 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
      • getAlias

        public String getAlias​(String name)
        Description copied from class: DefaultCodegen
        Determine the type alias for the given type if it exists. This feature was originally developed for Java because the language does not have an aliasing mechanism of its own but later extends to handle other languages
        Overrides:
        getAlias in class DefaultCodegen
        Parameters:
        name - The type name.
        Returns:
        The alias of the given type, if it exists. If there is no alias for this type, then returns the input type name.
      • toDefaultValue

        public String toDefaultValue​(io.swagger.v3.oas.models.media.Schema p)
        Description copied from class: DefaultCodegen
        Return the default value of the property

        This method should be overridden in the generator to meet its requirement. Return null if you do NOT want a default value. Any non-null value will cause {{#defaultValue} check to pass.

        Overrides:
        toDefaultValue in class DefaultCodegen
        Parameters:
        p - Property schema
        Returns:
        string presentation of the default value of the property
      • toExampleValue

        public String toExampleValue​(io.swagger.v3.oas.models.media.Schema p)
        Description copied from class: DefaultCodegen
        Return the example value of the property

        This method should be overridden in the generator to meet its requirement.

        Overrides:
        toExampleValue in class DefaultCodegen
        Parameters:
        p - Property schema
        Returns:
        string presentation of the example value of the property
      • getSchemaType

        public String getSchemaType​(io.swagger.v3.oas.models.media.Schema p)
        Description copied from class: DefaultCodegen
        returns the OpenAPI type for the property. Use getAlias to handle $ref of primitive type
        Overrides:
        getSchemaType in class DefaultCodegen
        Parameters:
        p - property schema
        Returns:
        string presentation of the type
      • 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
      • fromModel

        public CodegenModel fromModel​(String name,
                                      io.swagger.v3.oas.models.media.Schema model)
        Description copied from class: DefaultCodegen
        Convert OAS Model object to Codegen Model object.
        Specified by:
        fromModel in interface CodegenConfig
        Overrides:
        fromModel in class DefaultCodegen
        Parameters:
        name - the name of the model
        model - OAS Model object
        Returns:
        Codegen Model object
      • needToImport

        protected boolean needToImport​(String type)
        Description copied from class: DefaultCodegen
        Check the type to see if it needs import the library/module/package
        Overrides:
        needToImport in class DefaultCodegen
        Parameters:
        type - name of the type
        Returns:
        true if the library/module/package of the corresponding type needs to be imported
      • toEnumVarName

        public String toEnumVarName​(String value,
                                    String datatype)
        Description copied from class: DefaultCodegen
        Return the sanitized variable name for enum
        Overrides:
        toEnumVarName in class DefaultCodegen
        Parameters:
        value - enum variable name
        datatype - data type
        Returns:
        the sanitized variable name for enum
      • toEnumValue

        public String toEnumValue​(String value,
                                  String datatype)
        Description copied from class: DefaultCodegen
        Return the enum value in the language specified format e.g. status becomes "status"
        Overrides:
        toEnumValue in class DefaultCodegen
        Parameters:
        value - enum variable name
        datatype - data type
        Returns:
        the sanitized value for enum
      • fromOperation

        public CodegenOperation fromOperation​(String path,
                                              String httpMethod,
                                              io.swagger.v3.oas.models.Operation operation,
                                              List<io.swagger.v3.oas.models.servers.Server> servers)
        Description copied from class: DefaultCodegen
        Convert OAS 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 - OAS operation object
        servers - list of servers
        Returns:
        Codegen Operation object
      • setSerializableModel

        public void setSerializableModel​(Boolean serializableModel)
      • toRegularExpression

        public String toRegularExpression​(String pattern)
        Description copied from class: DefaultCodegen
        Return the regular expression/JSON schema pattern (http://json-schema.org/latest/json-schema-validation.html#anchor33)
        Overrides:
        toRegularExpression in class DefaultCodegen
        Parameters:
        pattern - the pattern (regular expression)
        Returns:
        properly-escaped pattern