[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] type pattern not matching when annotation values are enum instances (or psf Strings)
|
Consider the following annotation:
@Target(TYPE)
@Retention(RUNTIME)
public @interface Persistable {
StoreType in() default StoreType.MONGO;
IdType id() default IdType.STRING;
}
I'm attempting to match a type pattern in a declare parents based on
the id() property of the annotation:
declare parents :
(@Persistable(id=IdType.LONG) *)
implements L;
declare parents :
(@Persistable(id=IdType.STRING) *)
implements S;
These aren't matching successfully. However, if I change the
annotation to use Strings instead (like the following), the matching
starts working.
@Target(TYPE)
@Retention(RUNTIME)
public @interface Persistable {
String in() default "MONGO";
String id() default "STRING";
}
=====
declare parents :
(@Persistable(id="LONG") *)
implements L;
declare parents :
(@Persistable(id="STRING") *)
implements S;
Interestingly, if I create psf Strings for the values in the
annotation type and try to use those, like I show below, it fails to
match again.
@Target(TYPE)
@Retention(RUNTIME)
@Trait
public @interface Persistable {
public static final String MONGO = "MONGO";
public static final String JPA = "JPA";
public static final String JDO = "JDO";
public static final String STRING = "STRING";
public static final String LONG = "LONG";
String in() default "MONGO";
String id() default "STRING";
}
=====
declare parents :
(@Persistable(id=Persistable.LONG) *)
implements L;
declare parents :
(@Persistable(id=Persistable.STRING) *)
implements S;
The same is true if I move the psf Strings to an interface as well.
Am I doing something wrong?
-matthew
--
mailto:matthew@xxxxxxxxxxxxxxx
skype:matthewadams12
googletalk:matthew@xxxxxxxxxxxxxxx
http://matthewadams.me
http://www.linkedin.com/in/matthewadams