What happens if you then declare:
@ApplicationState
private SomeIntf<A> a;

with no name, and you have two objects of the same type declared elsewhere, with different names? Which object should "a" be resolved to? Arguably, if it can't be resolved, tapestry would need to throw an exception. Fine. I haven't looked in detail at the instantiation process for ASO's, but what happens if "namea" is defined on one page (page1), "nameb" on another(page2), and the above declaration on a third(page3)? Further suppose that on one application run, you hit page1->page3; then you (probably) wouldn't get an exception because at that point in time, there was only one instantiated ASO of that type. On other run, you do: page2->page3. Likewise, no exception, but you'll have a different object sitting in that variable! Finally, if you do page1->page2->page3, you hit an exception. Yuck. The solution to that problem would be for tapestry to pre-load all pages (as it did in T3 and T4). Also yuck. T5 startup time is wonderfully fast. I would hate to slow it down by making it preload/scan every page in the app.

Personally, I really like the "one class -> one value" approach. It's very straightforward, with zero configuration, and zero ambiguity. And, I don't have to constantly refer back to other pages to see what I named a particular ASO; I only have to know the type, and the ide helps me there. If I need multiple values of the same type, I use a wrapper object.

Robert

On Jun 27, 2008, at 6/279:08 AM , José Paumard wrote:

Hello all,

I declared an ASO like that

@ApplicationState
private SomeIntf<A> a ;

It works very well, and I can find this object across all my pages. But then I declared another one :

@ApplicationState
private SomeIntf<B> b ;

Following the way Java deals with templates, T5 considers that those two ASO are the same. It's not a big deal, I can extends SomeIntf<T> with SomeIntfA and SomeIntfB, and work things out like that, but I dont find that very elegant, plus it wont scale nicely as T takes more values.

So, would it be possible, or would it make sense, to have some kind of name attribute to the @ApplicationState, allowing one to discriminates ASO, something like that :

@ApplicationState(name="SomeIntfA")
private SomeIntf<A> a ;

and

@ApplicationState(name="SomeIntfB")
private SomeIntf<B> b ;

Bytheway, that would allow one to have different ASOs with the same type.

Thank you for your answers / thoughts / advice,

José


---------------------------------------------------------------------
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]

Reply via email to