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.

Not possible to annotate subclasses of ArrayAdapter with @EBean #347

Description

@dkunzler

It is not possible to annote custom subclasses of ArrayAdapter with @ebean since these need invoke a super constructor that contains a context as parameter.
Therefore it is not possible to create an empty constructor which is necessary to work with EBean.

Possible Solution:
Instead of insist on an empty constructor allow additionally a constructor taking a Context as parameter. If it is present call is with the context (The generated class has a Context in the constructor already, so it should be no problem to implement it.)

Activity

  1. dkunzler commented on Oct 21, 2012

    @dkunzler
    Author

    I just played around a bit and came up with a patch eventually.
    http://pastebin.com/HNJqGz8E
    However the Validation is missing for this.

  2. pyricau commented on Oct 22, 2012

    @pyricau
    Contributor

    Hi @dkunzler . I agree this can be a problem. We are still trying to figure out a way for @EBean to work properly on all levels (scopes, dependency injection, view injection), and maybe in the end we'll switch to an implementation that's quite different from the current one. But meanwhile, you just found a real problem and we need to fix it. Your solution seems quite appropriate.

  3. pyricau commented on Oct 22, 2012

    @pyricau
    Contributor

    As a side note, I don't think ArrayAdapters are much useful. I don't think they make things any easier, and for me extending BaseAdapter provides much more flexibility without requiring much extra code. If you look at ArrayAdapter code, you'll notice a lot of defending code to prevent bad usage of its API.

  4. mathieuboniface commented on Oct 22, 2012

    @mathieuboniface
    Contributor

    Why do we not simply recopy all the constructors from super class and add a super(...) call for each one ?

  5. mathieuboniface commented on Oct 22, 2012

    @mathieuboniface
    Contributor

    Ok, because the lifecycle of that components are managed by AA. #SelfAnswer

  6. dkunzler commented on Oct 22, 2012

    @dkunzler
    Author

    @pyricau Wow nicely done. Very fast reaction here.

    I will however take a look at the code of ArrayAdapter and the usage of a BaseAdapter implementing ListAdapter as you proposed.

    Thank you.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions