I want to create custom annotation in java for DirtyChecking
. Like I want to compare two string values using this annotation and after comparing it will return a
To answer your second question: your annotation can't return a value. The class which processes your annotation can do something with your object. This is commonly used for logging for example.
I'm not sure if using an annotation for checking if an object is dirty makes sense except you want to throw an exception in this case or inform some kind of DirtyHandler
.
For your first question: you could really spent some effort in finding this yourself. There are enough information here on stackoverflow and the web.