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.
Not possible to annotate subclasses of ArrayAdapter with @EBean #347
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.)
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.
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.
Activity
dkunzler commentedon Oct 21, 2012
I just played around a bit and came up with a patch eventually.
http://pastebin.com/HNJqGz8E
However the Validation is missing for this.
pyricau commentedon Oct 22, 2012
Hi @dkunzler . I agree this can be a problem. We are still trying to figure out a way for
@EBeanto 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.Allowing context constructors for @ebean. #347
pyricau commentedon Oct 22, 2012
As a side note, I don't think
ArrayAdapters are much useful. I don't think they make things any easier, and for me extendingBaseAdapterprovides much more flexibility without requiring much extra code. If you look atArrayAdaptercode, you'll notice a lot of defending code to prevent bad usage of its API.mathieuboniface commentedon Oct 22, 2012
Why do we not simply recopy all the constructors from super class and add a super(...) call for each one ?
mathieuboniface commentedon Oct 22, 2012
Ok, because the lifecycle of that components are managed by AA. #SelfAnswer
dkunzler commentedon Oct 22, 2012
@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.