Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Dynamic use of Inter-Type Declarations

Hi guys/girls.

I have a question that I was not able to compute when reading my
aspectJ books, and doing some googling.

The question is:
Is there a way of dynamicly at runtime add a new Inter-Type
Declaration on an object ?

Lets say I have a swing app with a panel containg a tree view of cd's
where the actual cd is the leaf.
One cd's could appair as a leaf in different subtrees (dimensions) e.g

Genre dimension
Genre
  +- Classical
       +- Mozart, Wolfgang Amadeus
           +- Mass in C minor
               -- Monteverdi Choir, John Elliot Gardiner


Playlist dimension
Down-Right-Terrific-Music
  -- Monteverdi Choir, John Elliot Gardiner



Then what I would like is to have an Inter-Type Declaration that
allows editing of data by adding an "Editable" interface and a
corresponding implementation.

In the treeview I then would like to use, let say, a right click on
the leaf and a context menu with all the legal functionality for that
leaf would pop up. I was thinking of using instanceof checking for
that.

So the main point beeing. In the Genre dimention i would like the Leaf
to implement the Editable interface, but in the Playlist dimention it
should not.

Is this at all possible ?


Best regards
Kaare Nilsen


Back to the top