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.

Allow subclasses as parameters #1285

Description

@WonderCsabo

Here #1162 (comment) @dodgex suggested to allow the subclass as a parameter. I think it would be very convenient to allow this for other listener annotations and other parameters.

@yDelouis WDTY? If it is a good idea we should review all params of all listener annotations and decide where it makes sense to allow subclass as param type.

Activity

  1. yDelouis commented on Dec 25, 2014

    @yDelouis
    Contributor

    I don't understand the comment and how it can help. Could you write an example ?

  2. WonderCsabo commented on Dec 25, 2014

    @WonderCsabo
    MemberAuthor

    Of course:

    // old way
    
    @Click
    void myButtonClicked(View view) {
       Button myButton = (Button) view;
       // do sg with myButton
    }
    
    // new way
    
    @Click
    void myButtonClicked(Button view) {
       // do sg with view
    }

    So it removes the need of casting as @ViewById does.

  3. yDelouis commented on Dec 25, 2014

    @yDelouis
    Contributor

    OK. How do we validate that the given view(s) have the right class ? And do we do when it is not the case ?

  4. WonderCsabo commented on Dec 25, 2014

    @WonderCsabo
    MemberAuthor

    What do you mean the right class? We cannot know what is the actual type of the object, this is the responsibility of the client. Just like with @ViewById.

  5. yDelouis commented on Dec 25, 2014

    @yDelouis
    Contributor

    You're right, it will just fail at runtime. I'm totally ok with that so.

  6. self-assigned this
    on Dec 25, 2014
  7. WonderCsabo commented on Dec 25, 2014

    @WonderCsabo
    MemberAuthor

    This is blocked by #1284.

  8. WonderCsabo commented on May 5, 2015

    @WonderCsabo
    MemberAuthor

    No longer blocked.

  9. removed their assignment
    on Jun 4, 2015
  10. WonderCsabo commented on Jun 4, 2015

    @WonderCsabo
    MemberAuthor

    This is now implemented for the most event binding annotations. If you need it for the rest, please open a new issue.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions