Remember that you can place @Inject on the constructor that should be used if there's any ambiguity.
On Tue, Oct 5, 2010 at 9:22 AM, Howard Lewis Ship <[email protected]> wrote: > Your are correct and this has been the behavior since at least 5.1. > > On Tue, Oct 5, 2010 at 9:21 AM, Josh Canfield <[email protected]> wrote: >>> >>> BeanEditor (used internally for BeanEditForm) uses the no-args constructor >>> if it exists. I apologize for not making this distinction clear. >>> >> >> I'm looking at the 5.2 source and BeanEditor uses the BeanModel to get >> the instance, calls "newInstance()" which also uses the >> ObjectLocator.autobuild >> >> On Tue, Oct 5, 2010 at 8:32 AM, Thiago H. de Paula Figueiredo >> <[email protected]> wrote: >>> On Tue, 05 Oct 2010 12:17:46 -0300, Michal Gruca <[email protected]> >>> wrote: >>> >>>> I must disagree. >>>> But first to clarify. I described two cases. >>>> 1. BeanEditForm that cannot instantiate my object >>> >>> BeanEditor (used internally for BeanEditForm) uses the no-args constructor >>> if it exists. I apologize for not making this distinction clear. >>> >>>> 2. Same issue for SSO creating java.util.Date >>> >>> ApplicationStateManager(Impl) uses ObjectLocator.autobuild() to construct >>> instances. >>> >>>> Ad 2. >>>> Quote from linked documentation: >>>> "The first time you access an SSO, it is created automatically. Typically, >>>> the SSO will have a public no-args constructor ... but you may inject >>>> dependencies into the SSO via its constructor, as you can with a Tapestry >>>> IoC service implementation." >>>> In this case I wanted to use Date. Maybe not some real case scenario, so >>>> let's think about shoping basket for example. It may have default no args >>>> for T5 and second one if I want to instantiate it with some products. If >>>> T5 always takes constructor with most arguments it will fail on that >>>> scenario >>>> also, meaning that I will have to check boolean variable companion exist >>>> on every page on which I wan't to use my object. >>> >>> In this case, use @SessionState(create = false) so the field is null when >>> it's not in the session. and you don't need to declare a boolean variable. >>> >>> -- >>> Thiago H. de Paula Figueiredo >>> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and >>> instructor >>> Owner, Ars Machina Tecnologia da Informação Ltda. >>> http://www.arsmachina.com.br >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >>> >> >> >> >> -- >> -- >> http://www.bodylabgym.com - a private, by appointment only, one-on-one >> health and fitness facility. >> -- >> http://www.ectransition.com - Quality Electronic Cigarettes at a >> reasonable price! >> -- >> TheDailyTube.com. Sign up and get the best new videos on the internet >> delivered fresh to your inbox. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > > > -- > Howard M. Lewis Ship > > Creator of Apache Tapestry > > The source for Tapestry training, mentoring and support. Contact me to > learn how I can get you up and productive in Tapestry fast! > > (971) 678-5210 > http://howardlewisship.com > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
