I am working on a project where I need to generate JSON schemas for all of the objects that are returned from my API.
I am given a String such as:
"com.example.CustomListing<MyClass>"
My goal is to create a schema for CustomListing
and insert a $ref
to MyClass
in all the places it is used in CustomListing
.
Jackson offers a way to create schemas from generics here but I need to have Class object for that generic type.
I can create a generic Class object using a method here but it requires me to know the type ahead of time, which I do not.
How can I get a Class<CustomListing<MyClass>>
when I am only given the String "com.example.CustomListing<MyClass>"
?
EDIT: I am creating these schemas in a JavaDoc doclet, so I am working at compile time, hence the limitations.