Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] Question on static cross-cutting and queries

I'd like to be able to write something like the following:

  public aspect ApplyStringable {
	declare parents: *..* where new(String) implements Stringable;
  }

The idea would be to apply the interface Stringable to every class with
a single-argument constructor that takes a String as an argument.

From what I know and have used of AspectJ, the only way to do this is to
actually enumerate all of the classes that this would apply to.  (And I
can imagine the difficulties with this sort of query as related to
precendence of operation and other aspects that may have already been
applied.)

Has this sort of functionality been tried?  Is there another way to
accomplish the same thing?  (I know how to do it with BCEL, but that's
not the point...)

Thanks in advance for any ideas.

	-- Paul


Back to the top