Add support for type-use annotations (TYPE_USE target) (JSR 308, Java 8+)#127
Conversation
|
I've gone a different route here than the one suggested in #50, because this allows us to avoid a breaking change. I haven't managed to come up with a better name than This problem came up for me in jsonschema2pojo, because using javax/jakarta's @Valid annotation for arrays and other collections is now supposed to go onto the item type, not onto the container field. More info in joelittlejohn/jsonschema2pojo#1770 and serverlessworkflow/sdk-java#1123. |
|
Thank you! |
|
@joelittlejohn thanks a lot for your effort - really appreciate it. Do you have anything more in the pipeline or can I start preparing the 4.2.0 release? |
|
@phax Great stuff! I want to add another change here to support params in these type annotations. This will be arriving today and I'll open a new PR. |
Adds JAnnotatedClass which wraps an AbstractJClass with type-use annotations, enabling code generation like List<@Valid Item>.
Usage:
AbstractJClass annotatedItem = itemClass.annotated(Valid.class);
AbstractJClass listType = cm.ref(List.class).narrow(annotatedItem);
Addresses #50