"Geir Magnusson Jr." wrote:

> What I would like to see, and will upload to the whiteboard the
> implementation right after this post is the something I called an
> EventCartridge  (for lack of a better name) with an app level API :
> 
> public class EventCartridge
> {
>   /** add a handler to the cartridge */
>   public boolean addEventHandler( EventHandler ev )
> 
>   /** attach the cartridge to the context */
>   public boolean attachToContext( Context context )
> }
> 
> And I currently have two event handlers :
> 
> For Leon and Chris Kimpton (and we can split this up into two separate
> handlers) :
> 
> public interface  ReferenceInsertionEventHandler extends EventHandler
> {
>   /** called right before inserting a reference val to stream */
>   public String referenceInsert( String reference, String value  );
> 
>   /** called when a ref evals to null to determine if render -
>    *  think of it as a 'dynamic Quiet reference'  */
>   public boolean nullReferenceRender( String reference );
> }
> 
> For Christoph :
> 
> public interface NullSetEventHandler extends EventHandler
> {
>     /** approve/reject log message for #
>      * set($foo = <eval to null>) situation */
>     public boolean nullSetLogMessage( String reference );
> }
> 
> and we can design more as needed.

I like that. Simple & flexible. Logic for Listener support 
can be encapsulated in the Cartridge class.
No cartridge = minimal penalty, so major part of the user base
will be unaffected.
As far as I can tell, it will solve Leon's escaping problem.

One thing came to my mind - maybe the value passed to the
referenceInsert
should be of type Object, so that the method could do something special
for rendering it into a String insetead of calling Object.toString() ?
I'm not sure if it will be usefull to anyone, because it's easy to
put that logic into a wrapper class, but it would give a bit more 
flexiblity...

Rafal

--
Rafal Krzewski
Senior Internet Developer
mailto:[EMAIL PROTECTED]
+48 22 8534830 http://e-point.pl

Reply via email to