How to include a custom annotation on generated classes
See original GitHub issueI’d like to add the immutables annotation (@Value.Immutable
) to generated classes. Are there any other options to do so besides modifying the jsonschema2pojo source and implementing a custom Annotator?
Thanks!
Issue Analytics
- State:
- Created 8 years ago
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Creating a Custom Annotation in Java - Baeldung
We're going to create three custom annotations with the goal of serializing an object into a JSON string. We'll use the first one...
Read more >Java: Creating and Using Custom Annotations - Medium
Here is an example to demonstrate the use of custom annotation. It is about 2 classes, Car and Engine. Suppose we have a...
Read more >Can I use custom annotations to classify Java classes?
Use annotations to make a map of value->class(es)? Sure that's possible. Just add an annotation handler and have it accumulate in a multimap, ......
Read more >Customize Java Annotation with Examples - GeeksforGeeks
Using the same fashion, we create our second annotation to mark the fields that we are going to include in the generated JSON...
Read more >Using Custom Annotation Processors - Apache NetBeans
The annotation processor used as the example generates a parent class for the annotated class. The generated parent class also contains a method...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is an older example, but here is a custom type annotator I was using to deserialize java.util.Set as java.util.LinkedHashSet, before this feature was merged into the project.
I built this in its own module and then included it in my configuration:
This was enough to get custom annotations on the java.util.Set fields. Hope this helps!
Either of these methods could be used to add a class level annotation: