[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[aspectj-users] How do you introduce a method on a Java5 enum?
|
- From: Matthew Adams <matthew@xxxxxxxxxxxxxxx>
- Date: Thu, 1 Oct 2009 14:13:41 -0700
- Delivered-to: aspectj-users@eclipse.org
I want to add a method to all enums with the signature "String getName()".
Any ideas?
This doesn't appear to work:
public aspect GetNameEnumIntroduction {
interface Introduced { String name(); }
declare parents : (Enum+) implements Introduced;
public String Introduced.getName() {
return this.name();
}
}
It also doesn't work if I change the type expression of declare
parents to (Enum<? extends Enum>+).
Thanks,
Matthew
--
mailto:matthew@xxxxxxxxxxxxxxx
skype:matthewadams12
yahoo:matthewadams
aol:matthewadams12
google-talk:matthewadams12@xxxxxxxxx
msn:matthew@xxxxxxxxxxxxxxx
http://matthewadams.me
http://www.linkedin.com/in/matthewadams