commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brett Henderson" <>
Subject RE: [codec] StatefulDecoders
Date Thu, 11 Mar 2004 02:40:44 GMT
> Take a look at the "Reclaiming Type Safety" section in this 
> article on the 
> event notification pattern here:
Cool, that's a neat way of achieving type safety.  Avoiding downcasts (eg.
Object to byte[]) is a good thing.  It still relies on a runtime check but
is only performed in one piece of code instead of every implementation of an
event receiver.

Type safety enforced in a single class instead of using downcasts within
each event receiver.
Single event method defined in interfaces instead of methods per event type.
No need to define separate interfaces per event type.

No compile time type checking, incorrect types may not be picked up during
Runtime overhead to perform reflection on event receiver class and locate
type specific event receiver method.
Runtime overhead converting from generic event type to specific event type.

I don't know if compile time or runtime checks should be used but if runtime
checks are chosen then this pattern is a good way of enforcing them.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message