[Biojava-l] Proposal: ChangeType hierarchies

Matthew Pocock mrp@sanger.ac.uk
Thu, 22 Feb 2001 12:48:49 +0000


Thomas Down wrote:

> Now that we're comfortable working with ChangeEvents, I'd
> like to propose a really simple enhancement to the
> ChangeType objects:
> 
>   - Add two methods to ChangeType:
> 
>      public ChangeType getParent();
>      public boolean isSubType(ChangeType t);
> 
>   - Add extra constructors to ChangeType objects which allow
>     a parent to be specified.  If the current (no-parent)
>     constructors are used, we default to ChangeType.UNKNOWN
>     (which becomes the root of the type hierarchy).
> 
>     [Open issue: what is the value of ChangeType.UNKNOWN.getParent()?]

null, I think. Alternatively, it is its own parent (uck).

> 
>   - ChangeEvent sources use isSubType() to check if a listener
>     is interested in a given ChangeType, rather than simple
>     object equality.  Right  now, I can't think of any event sources
>     which don't use ChangeSupport, so that's the only  place
>     we would have to make this change.
> 
>   - Once nice side effect of this is that registering a listener
>     with no specified type becomes exactly equivalent to listening
>     for ChangeType.UNKNOWN
> 
> This change would make it easy for specific implementations of
> an interface to fire specialized sub-types of some common change
> types.  Client code can then listen either to one or more of
> the specialized types, OR to the common base type.
> 
> Impact on current code would be minimal -- The only
> place I can think of where any changes will be needed
> is ChangeSupport.

We should also remove the add/removeChangeListener(listener) methods, 
requiring add/removeChangeListener(listener, UNKNOWN) to be used instead.

> 
> What do people think of this one?
> 
>    Thomas.
> _______________________________________________
> Biojava-l mailing list  -  Biojava-l@biojava.org
> http://biojava.org/mailman/listinfo/biojava-l


Do we have the ChangeEvent -> bean property event bridge? This should be 
an early priority for 1.2