For making custom rule, i want to get uri value

I makes custom rule
for checking api url value follows camel case.

So I want to get annoatation’s value.
( the annotations i will check is : @RequestMapping, @GetMapping, @PostMapping)

And these annotatios used like that

  1. @RequestMapping(value = “/v1/guides”, headers = “Content-Type= multipart/form-data”, method = RequestMethod.POST)
  2. @GetMappint (value = “/v1/test”)

And I extract from annoations only the ‘Strings’ of “value” like “/v1/guides”
(and then i will parse these strings with “/” )
( and i don’t need to get “header” and “method” 's value like “multipart/form-data”, “RequestMethod.POST”)
how to i get it?

  • i try to use “valuesForAnnotation” but i cannot tranfoms values to “String” - only object i can get.


You correctly identified the method valuesForAnnotation. It returns a list of AnnotationValue, containing String name(); and Object value();.
value has type Object because it is not always a String (for example @GetMapping (value = MY_CONSTANT)).
I invite you to use the debugger to identify exactly what is inside this Object. I expect it to be String[].

Hope it helps,