Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
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

Closed

Description

@WonderCsabo

For details see #1058, more precisely this comment for implementation details.

Activity

  1. yDelouis commented on Oct 3, 2014

    @yDelouis
    Contributor

    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.

  2. WonderCsabo commented on Oct 3, 2014

    @WonderCsabo
    MemberAuthor

    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.

  3. dodgex commented on Oct 3, 2014

    @dodgex
    Member

    if a param annotation is not related to any other

    @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.

  4. WonderCsabo commented on Oct 3, 2014

    @WonderCsabo
    MemberAuthor

    I guess you right, my example was bad. Anyways, i still think the other way would be much cleaner if it can work.

  5. yDelouis commented on Oct 3, 2014

    @yDelouis
    Contributor

    The purpose of model extractor is to find annotations in parent classes to generate the related things in the child class. For example :

    @EBean
    public class Parent {
        @RootContext Context context;
    
        @AfterInject void afterInject() {}
    }
    
    @EBean
    public class Child extends Parent {
    
    }

    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.

  6. WonderCsabo commented on Oct 3, 2014

    @WonderCsabo
    MemberAuthor

    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.

  7. WonderCsabo commented on Oct 5, 2014

    @WonderCsabo
    MemberAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions