+ 2

Java custom annotation

How can i find out which class processes a custom annotation? Ie, where is the code that understands what to do when an annotation exists?

31st Jul 2020, 4:20 PM
ifl
ifl - avatar
11 Respostas
+ 1
Sandra Meyer i meant dev defined annotations.
31st Jul 2020, 4:29 PM
ifl
ifl - avatar
+ 1
Sandra Meyeri looked some docs, understand how to create the annotations all right, just miss where the processing class is referenced. Btw i fail to see how the reference you are mentioning is answering the question, can you quote the relevant bit?
31st Jul 2020, 5:33 PM
ifl
ifl - avatar
+ 1
"Or try to look it up" ... lol.
31st Jul 2020, 6:09 PM
ifl
ifl - avatar
+ 1
Michal this is a springboot app.
31st Jul 2020, 6:17 PM
ifl
ifl - avatar
+ 1
ifl I don't really know what do you want to achieve, but you can use AOP, create an Aspect and add advice which will be trigger for every method / class you just annotated.
31st Jul 2020, 6:26 PM
Michal
Michal - avatar
+ 1
Michal thanks, thats the beginning of an answer.... the initial question was more about how to find out which class is the processor of the annotation (if written by someone else)
1st Aug 2020, 5:55 AM
ifl
ifl - avatar
0
What sort of custom annotation do you mean? Really user (dev) defined annotations or only the "normal", modeled annotations or Json fields?
31st Jul 2020, 4:25 PM
Sandra Meyer
Sandra Meyer - avatar
0
So, you want to create a new dev framework? For real?
31st Jul 2020, 4:31 PM
Sandra Meyer
Sandra Meyer - avatar
0
Btw. take a look into java.lang.annotation
31st Jul 2020, 4:32 PM
Sandra Meyer
Sandra Meyer - avatar
0
Are you using spring or something?
31st Jul 2020, 5:02 PM
Michal
Michal - avatar
0
Well that depends on the sort of annotations you want to create... There are many kinds of annotations, and you need to describe what you want to create. Or you try to look it up, in the basic annotations codes.
31st Jul 2020, 5:35 PM
Sandra Meyer
Sandra Meyer - avatar