Skip to main content

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


Kaare,

The main restriction here lies with the JVM rather than Java or AspectJ. Even Hot-Swap implementations don't support adding or removing methods (as far as I know). However a important question is why you feel you need it in this scenario? While there may be compelling use cases for runtime AOP, e.g. 24x7 systems, this one does seem to be one. Why would the user not want to edit information in both views? Why not use additional context i.e. the view to determine whether the information can be edited rather that relying solely on the interfaces supported seeing as you will need this information to determine whether a runtime ITD should be used.

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx

http://w3.hursley.ibm.com/~websterm/

Please respond to aspectj-users@xxxxxxxxxxx

Sent by:        aspectj-users-bounces@xxxxxxxxxxx

To:        aspectj-users@xxxxxxxxxxx
cc:        
Subject:        [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
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top