I prefer to keep genericDao private and init this Dao just as what Climbingrose did(Sometime I do init in Setter method.). So I do not need to cast genericDao to categoryDao. I do not like cast!! :)
Thanks. Simon On 1/29/07, Matt Raible <[EMAIL PROTECTED]> wrote:
I've made this change in SVN. http://tinyurl.com/22l49a Matt On 1/29/07, climbingrose <[EMAIL PROTECTED]> wrote: > I thought genericDao and categoryDao will be the same by the fact that > categoryDao is passing to GenericManagerImpl. If they are the same then I > can simply cast genericDao to CategoryDao and use its > getTopLevelCategories() method. > > > On 1/30/07, Matt Raible <[EMAIL PROTECTED]> wrote: > > > > We can change genericDao to protected, but I don't see how it solves > > your problem. This interface doesn't have the > > "getTopLevelCategories()" method, so you'll still need to set your > > categoryDao. > > > > Matt > > > > On 1/29/07, climbingrose <[EMAIL PROTECTED]> wrote: > > > I wonder what would be the appropriate way to extend GenericManager and > > > GenericManagerImpl to add custom behaviours? > > > What I have done is: > > > > > > public class CategoryManagerImpl extends GenericManagerImpl implements > > > CategoryManager { > > > > > > private CategoryDao categoryDao; > > > > > > public CategoryManagerImpl(CategoryDao categoryDao) { > > > super(categoryDao); > > > this.categoryDao = categoryDao; > > > } > > > > > > public List getTopLevelCategories() { > > > return categoryDao.getTopLevelCategories(); > > > } > > > > > > } > > > > > > I haven't looked at GenericManagerImpl source code but it seems to > contain a > > > private instance of GenericDao (genericDao). Obvious if genericDao is > > > protected then I don't ned categoryDao anymore. > > > > > > -- > > > Regards, > > > > > > Cuong Hoang > > > > > > -- > > http://raibledesigns.com > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > Regards, > > Cuong Hoang -- http://raibledesigns.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
