You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Add ability to the framework for processing annotations on method parameters #1169
There is nothing to do to allow annotations on method parameters.
We create a Handler extending BaseAnnotationHandler and for now, because the Handler does not do anything in process (the annotation handler on the method will do the processing), we don't have to change the ModelExtractor.
The only thing I did is to allow annotations which are subclasses of another annotation.
If we go this way, we cannot really split off handling the annotation from its "parent".
Also, if a param annotation is not related to any other, how we could process it if we do not change the extractor?
Anyway, i think changing the extractor to collect annotations on params is much cleaner then the current way.
@WonderCsabo not sure what exactly you mean. When a param annotation does not relate to any method annotation? i think there should be no case where a param is annotated but not the method it is used in. i can't imagine a situation where one would have an annotation that is only related to a param with no actual context to the parent that has a related annotation.
In this case, we have to generate things related to @RootContext and @AfterInject in the class Child_. This annotations will be found by ModelExtractor and the method process of the corresponding Handler will be called.
It the case of parameters, since process won't be called we don't have to find the annotations in parent classes. All processing will be done by the annotation on the method.
ModelExtractor is responsible for returning all annotations. E.g. on the current class and on the superclasses. But it does not returns the annotations on the current class for method params.
OK, i do not know why i believed that param annotation handlers are not get called.
If all param annotations has method annotations related to them, i am OK with the current sitation.
I guess there is no way to completely separate the method annotation handler and the param annotation handler? Currently all processing is done in the first one, and the two classes are very closely tied to each other.
Activity
yDelouis commentedon Oct 3, 2014
There is nothing to do to allow annotations on method parameters.
We create a
HandlerextendingBaseAnnotationHandlerand for now, because theHandlerdoes not do anything inprocess(the annotation handler on the method will do the processing), we don't have to change theModelExtractor.The only thing I did is to allow annotations which are subclasses of another annotation.
WonderCsabo commentedon Oct 3, 2014
If we go this way, we cannot really split off handling the annotation from its "parent".
Also, if a param annotation is not related to any other, how we could process it if we do not change the extractor?
Anyway, i think changing the extractor to collect annotations on params is much cleaner then the current way.
dodgex commentedon Oct 3, 2014
@WonderCsabo not sure what exactly you mean. When a param annotation does not relate to any method annotation? i think there should be no case where a param is annotated but not the method it is used in. i can't imagine a situation where one would have an annotation that is only related to a param with no actual context to the parent that has a related annotation.
WonderCsabo commentedon Oct 3, 2014
I guess you right, my example was bad. Anyways, i still think the other way would be much cleaner if it can work.
yDelouis commentedon Oct 3, 2014
The purpose of model extractor is to find annotations in parent classes to generate the related things in the child class. For example :
In this case, we have to generate things related to
@RootContextand@AfterInjectin the classChild_. This annotations will be found byModelExtractorand the methodprocessof the correspondingHandlerwill be called.It the case of parameters, since
processwon't be called we don't have to find the annotations in parent classes. All processing will be done by the annotation on the method.WonderCsabo commentedon Oct 3, 2014
ModelExtractoris responsible for returning all annotations. E.g. on the current class and on the superclasses. But it does not returns the annotations on the current class for method params.WonderCsabo commentedon Oct 5, 2014
OK, i do not know why i believed that param annotation handlers are not get called.
If all param annotations has method annotations related to them, i am OK with the current sitation.
I guess there is no way to completely separate the method annotation handler and the param annotation handler? Currently all processing is done in the first one, and the two classes are very closely tied to each other.
Either way, this issue can be closed.