Or do something like user?.address?.property Uli
On 24.08.2011 16:38, Ulrich Stärk wrote: > Just contribute your own coercion from Object -> Boolean. > > On 24.08.2011 16:23, Denis Stepanov wrote: >>> "X doesn't do what I want" is not a strong argument. In order to convince >>> someone to apply the patch, you need to make more efforts to describe you >>> issue. After reading all of your mails I'm still not sure what is the issue >>> with existing syntax. Please explain exactly your use case. As always some >>> examples can help. >> OK Sorry :) >> >> The issue is how to implement a null check logic in tml. Lets say we have an >> object User and an Address, now if address is not null I want to display >> something different. >> >> If I use: >> >> <t:if test="user.address"> or <t:unless test="!user.address"> >> >> in this case "address" will be converted to a boolean by coercion object -> >> string -> boolean but I don't want additional toString metod called here, >> our toStrings are implemented using reflection based ToStringBuilder, on >> complex object it could load alot of stuff for the DB or just simple >> toString equals "true" could slowdown rendering. >> >> It seems to me that intuitive way is to use: >> >> <t:if test="user.address?"> >> >>> What's the code that does that? Wouldn't it be better to just change it so >>> the ! operator works without using toString()? >> Tapestry coercion code and I don't think it could be changed. >> >> Denis >> >> >> >> >> >> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
