--- /dev/null
+package c.d;
+
+import java.lang.annotation.*;
+
+public class DistantResource {
+ public static void main(String []argv) {
+ Annotation [] annos = DistantResource.class.getAnnotations();
+ for (int i=0;annos!=null && i<annos.length;i++) {
+ System.out.println("Annotation is "+annos[i]);
+ }
+ }
+}
--- /dev/null
+
+
+aspect ConfigureTracing {
+ declare @type : MyPojo : @Tracing(level = LoggingLevel.WARN);
+// declare @method : * MyPojo.calculate() : @TestAnnotation;
+}
+
+@interface Tracing { LoggingLevel level(); }
+
+@interface TestAnnotation {}
+
+class Level {
+ Level(int i) {}
+ public final static Level INFO = new Level(1);
+ public final static Level WARN = new Level(2);
+ public final static Level ERROR = new Level(3);
+}
+//@Tracing(level = LoggingLevel.WARN)
+enum LoggingLevel {
+ INFO(Level.INFO),
+ WARN(Level.WARN),
+ ERROR(Level.ERROR);
+
+ private final Level level;
+ private LoggingLevel(Level level) {this.level = level;}
+ public Level getLevel() {return level;}
+}
+
+public class MyPojo {
+ public static void calculate() {
+ }
+ public static void main(String []argv) {
+
+ }
+}
--- /dev/null
+package a.b;
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface SimpleAnnotation {
+ String classname();
+}
+
--- /dev/null
+package e.f;
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface SimpleAnnotation2 {
+ String classname();
+}
+
--- /dev/null
+package a.b;
+
+// explicitly reference target type in another package
+aspect SimpleAspect1 {
+ declare @type: c.d.DistantResource: @SimpleAnnotation(classname="oranges");
+}
--- /dev/null
+package a.b;
+
+import c.d.DistantResource;
+
+// import target type
+aspect SimpleAspect1 {
+ declare @type: DistantResource: @SimpleAnnotation(classname="oranges");
+}
--- /dev/null
+package a.b;
+
+// fully qualified reference to annotation type
+aspect SimpleAspect3 {
+ declare @type: c.d.DistantResource: @e.f.SimpleAnnotation2(classname="oranges");
+}
--- /dev/null
+package a.b;
+
+import c.d.DistantResource;
+import e.f.SimpleAnnotation2;
+
+// import the annotation type
+aspect SimpleAspect4 {
+ declare @type: DistantResource: @SimpleAnnotation2(classname="oranges");
+}