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