0

I am using Kotlin with spring. I want to convert request which comes from the front end. My enum class is:

enum class Type() {
    PARTIAL,
    FULL;

    fun equal(type:String){
        return this.equal(type.toUpperCase())
    }
}

My get api request is like this

fun updateUserInfo(user: User, @Valid @RequestBody request: RequestBody) {...}

My Request body is like this:

class RequestBody private constructor() {

    @NotNull
    lateinit var type: Type


    @NotBlank
    @Size(max = 40)
    lateinit var fullName: String
}

My question is this frontend might using small casing like partial,full. I want to add modifier irrespective of anything frontend send my Type enum should always give an upper case in updateUserInfo function. How can I do it?

thealchemist
  • 421
  • 4
  • 12

0 Answers0