diff options
author | Andy Clement <aclement@gopivotal.com> | 2014-08-05 14:34:07 -0700 |
---|---|---|
committer | Andy Clement <aclement@gopivotal.com> | 2014-08-05 14:34:07 -0700 |
commit | dbcd8691f40e29a49f15465716e137d439d2268b (patch) | |
tree | 83420e36955f284af806a1c3812300153f21ac41 /tests/generated | |
parent | cd74697aa7273537f92414e8266b001699ccaa0a (diff) | |
download | aspectj-dbcd8691f40e29a49f15465716e137d439d2268b.tar.gz aspectj-dbcd8691f40e29a49f15465716e137d439d2268b.zip |
Tidy up post APT changes
Diffstat (limited to 'tests/generated')
-rw-r--r-- | tests/generated/test/SomeCallbacks.java | 14 | ||||
-rw-r--r-- | tests/generated/test/SomeEventsAspect.aj | 50 |
2 files changed, 64 insertions, 0 deletions
diff --git a/tests/generated/test/SomeCallbacks.java b/tests/generated/test/SomeCallbacks.java new file mode 100644 index 000000000..f40ea5fac --- /dev/null +++ b/tests/generated/test/SomeCallbacks.java @@ -0,0 +1,14 @@ +package test; + +/** + * Events' callbacks for test.Some. + * + * @author test.SimpleProcessor + */ +public final class SomeCallbacks { + public interface OnMethod1 { + void changed(Some emmiter); + } + +} + diff --git a/tests/generated/test/SomeEventsAspect.aj b/tests/generated/test/SomeEventsAspect.aj new file mode 100644 index 000000000..f661f237c --- /dev/null +++ b/tests/generated/test/SomeEventsAspect.aj @@ -0,0 +1,50 @@ +package test; +import java.util.ArrayList; +import java.util.Collection; + +/** + * Events for test.Some. + * + * @author test.SimpleProcessor + */ +@javax.annotation.Generated("test.SimpleProcessor") +final aspect SomeEventsAspect { + + public static final class SomeOnMethod1Event { + private Collection<SomeCallbacks.OnMethod1> callbacks = null; + + SomeOnMethod1Event() { + } + + public void add(SomeCallbacks.OnMethod1 callback) { + Collection<SomeCallbacks.OnMethod1> callbacksSafe = callbacks; + if (callbacksSafe == null) { + callbacksSafe = new ArrayList<>(1); + callbacks = callbacksSafe; + } + callbacksSafe.add(callback); + } + + public void clean() { + callbacks = null; + } + } + + private static void emit(SomeOnMethod1Event event, Some emmiter) { + final Collection<SomeCallbacks.OnMethod1> callbacksSafe = event.callbacks; + if (callbacksSafe == null) + return; + for (final SomeCallbacks.OnMethod1 callback : new ArrayList<>(callbacksSafe)) + callback.changed(emmiter); + } + + @SuppressWarnings("PublicField") + public final SomeOnMethod1Event test.Some.OnMethod1Event = new SomeOnMethod1Event(); + + before(): execution(void test.Some.method1()) { + final test.Some emmiter = (test.Some) thisJoinPoint.getThis(); + emit(emmiter.OnMethod1Event, emmiter); + } + +} + |