Annotation Processing in Java | Create a Custom Annotation Processor | Geekific

preview_player
Показать описание

The source-level annotation processing first appeared in Java 5. It is a technique that allow us to add additional source files to our project during the compilation stage. The files generated don’t have to be Java files, rather any kind of description, metadata, documentation, resource, or any other type of file can be added based on the annotations in our source code. In this video, we make use of annotation processing to generate our own Java class.

Timestamps:
00:00 Introduction
00:55 Set-Up needed Annotations
01:43 Create the Processor
05:10 Generate the Java Class
06:22 Compile and Test the Code!
07:30 Thanks for Watching!

If you found this video helpful, check other Geekific uploads:

#Geekific #AnnotationProcessing #Java #JavaAnnotations
Рекомендации по теме
Комментарии
Автор

Looked so many articeles to work with Custom annotation. Couldn't find one.

Stumbled acroos this today. This was really great and very well structured.

Keep up the good work . Thanks again🎉🎉

AdarshaPal-wo
Автор

best video for annotations processing, i search a lot even in ChatGpt and nothing works without a external libs, but u give us gold man thanks ❤

bibahbibah
Автор

This channel is a treasure trove of useful Java and computer science info! 🎉🎉🎉 Keep up the good work! 💯👏

lewnpapadopoulos
Автор

Hi Great explanation, Few questions :
1. I noticed that you have listed the model module before the processor module in the aggregator pom, isn't the correct build order other way round ?
2. also I do not see the annotationProcessorPath added anywhere how will maven-comopiler-plugin find the processor ?

karthikbankapur
Автор

Nice explanation, thank you for taking the time to create this video, I subscribed immediately.

nerminkarapandzic
Автор

I tried this before and it never worked, but after this video I finally got it to work! Thanks!

But I got one question, how can I make annotations to generate code into the same class and make it usuable while coding? (Just like Lombok with @Getter, @Setter, etc...)

grcq_apex
Автор

thank you for the explanation of this topic!

svalyavasvalyava
Автор

I have similar use case but using custom annotation i want to generate a logger object
Something similar to what @sl4j of lombos does.
I have done all the steps but unable to get object of my custom logger class when I use the custom class level annotation

AdarshaPal-wo
Автор

Excellent 👍

Is it possible to change or modify existing class such as @NotNull annotations?

iamshakiransari
Автор

How do I do it without having to pull in a package?

Grynjolf
Автор

but how process method is getting called?

wasim
join shbcf.ru