Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [handly-dev] Doing work in Handle or in Body

Hi Vlad,
 
Well, it is true that "handle only" methods must traffic strictly in handles and it is important for clients to tell them apart as such (usually it is explicitly stated in a Javadoc). As a rule, non-handle-only methods throw CoreException (since to do their work they need information from a body and #getBody() throws CoreException). Handle-only methods should not throw CoreException.
 
There is no rule that non-handle-only methods must delegate their work to a body (if I understand you correctly). I think what's really important here is the distinction between "handle only" and "other" methods for model elements; contract rather than implementation details.
 
Hope it makes sense.
Vladimir
 
P.S. I will be offline from now until Monday. Sorry for the possible delay in responding.
 
 
Hi,

I caught myself doing something that might be a Bad Thing (TM), but I'm only 97% sure, so I thought I'd check. Bu Handle and body below I mean descendants of these classes.

Any work that isn't "handle only" should be done in a Body implementation, not in the Handle, right?

Should I keep track of the Handle methods that delegate to the Body so that I don't call them from a "handle only" context? Ideally, it would be nice to be able to annotate these methods and let the compiler warn when I do something less than nice. 

best regards,
Vlad


Back to the top