From c82127f4e6f2a77f9f1e4c1a287cb73de0fb94de Mon Sep 17 00:00:00 2001 From: acolyer Date: Wed, 17 Aug 2005 16:35:01 +0000 Subject: [PATCH] deleted the section about declaring a pertypewithin aspect with a type variable. We could consider supporting this beyond AspectJ 1.5.0 perhaps, but not before. --- docs/adk15ProgGuideDB/pertypewithin.xml | 27 +------------------------ 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/docs/adk15ProgGuideDB/pertypewithin.xml b/docs/adk15ProgGuideDB/pertypewithin.xml index 1b062535c..8bab12b5d 100644 --- a/docs/adk15ProgGuideDB/pertypewithin.xml +++ b/docs/adk15ProgGuideDB/pertypewithin.xml @@ -75,38 +75,13 @@ Then one aspect instance will be created for each type within org.xyz..*. For each aspect instance, the after returning advice will match only the execution of constructors - in the type that the aspect is an instance of. The net result is that + within the matched per-type-within type. The net result is that the aspect tracks all known instances of each type within org.xyz..*. To get access to the instances, a programmer can simply write InstanceTracking.aspectOf(org.xyz.SomeType.class).getInstances(). - - A pertypewithin aspect may optionally be declared - with a single generic type parameter. In this case, for each type - T matched by the type pattern, the aspect instance - created will be of type PerTypeWithinAspect<T>. - So the previous example could also be written as: - - - pertypewithin(org.xyz..*) { - - // use WeakHashMap for auto-garbage collection of keys - private Map instances = new WeakHashMap(); - - after(T t) returning : execution(new(..)) && this(t) { - instances.put(t, true); - } - - public Set getInstances() { - return instances.keySet(); - } - - } - ]]> - The pertypewithin aspect instantiation model should be used when the implementation of a crosscutting concern requires that -- 2.39.5