### Eclipse Workspace Patch 1.0 #P weaver Index: .project =================================================================== RCS file: /cvsroot/tools/org.aspectj/modules/weaver/.project,v retrieving revision 1.1 diff -u -r1.1 .project --- .project 16 Dec 2002 18:02:43 -0000 1.1 +++ .project 26 Oct 2007 15:12:06 -0000 @@ -11,12 +11,13 @@ - org.eclipse.jdt.core.javabuilder + org.eclipse.ajdt.core.ajbuilder + org.eclipse.ajdt.ui.ajnature org.eclipse.jdt.core.javanature Index: .classpath =================================================================== RCS file: /cvsroot/tools/org.aspectj/modules/weaver/.classpath,v retrieving revision 1.6 diff -u -r1.6 .classpath --- .classpath 26 Oct 2006 10:17:34 -0000 1.6 +++ .classpath 26 Oct 2007 15:12:06 -0000 @@ -2,15 +2,16 @@ - + - + - - + + + Index: src/org/aspectj/weaver/CustomMungerFactory.java =================================================================== RCS file: src/org/aspectj/weaver/CustomMungerFactory.java diff -N src/org/aspectj/weaver/CustomMungerFactory.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/aspectj/weaver/CustomMungerFactory.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,13 @@ +package org.aspectj.weaver; + +import java.util.Collection; + +import org.aspectj.weaver.AjAttribute.TypeMunger; +import org.aspectj.weaver.patterns.Declare; + +public interface CustomMungerFactory { + public Collection createCustomTypeMungers(ResolvedType aspectType); + public Collection createCustomShadowMungers(ResolvedType aspectType); + public Collection createCustomDeclares(ResolvedType aspectType); + +} Index: src/org/aspectj/weaver/CustomMungerExtension.aj =================================================================== RCS file: src/org/aspectj/weaver/CustomMungerExtension.aj diff -N src/org/aspectj/weaver/CustomMungerExtension.aj --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/aspectj/weaver/CustomMungerExtension.aj 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,49 @@ +package org.aspectj.weaver; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.aspectj.weaver.AjAttribute.TypeMunger; +import org.aspectj.weaver.patterns.Declare; + +public privileged aspect CustomMungerExtension { + + private List customMungerFactories = new ArrayList(); + private boolean enabled = false; + + pointcut addOrReplaceAspect(ResolvedType aspectType, boolean inWeavingPhase): + execution(* CrosscuttingMembersSet.addOrReplaceAspect(..)) && args(aspectType, inWeavingPhase); + + after(ResolvedType aspectType, boolean inWeavingPhase, + CrosscuttingMembersSet xSet): + addOrReplaceAspect(aspectType, inWeavingPhase) && this(xSet) { + if (inWeavingPhase && isEnabled()) { + CrosscuttingMembers xcut = (CrosscuttingMembers) xSet.members + .get(aspectType); + for (CustomMungerFactory factory : customMungerFactories) { + Collection customTypeMungers = factory.createCustomTypeMungers(aspectType); + if (customTypeMungers != null) + xcut.addTypeMungers(customTypeMungers); + Collection customShadowMungers = factory.createCustomShadowMungers(aspectType); + if (customShadowMungers != null) + xcut.addShadowMungers(customShadowMungers); + Collection customDeclare = factory.createCustomDeclares(aspectType); + if (customDeclare != null) + xcut.addDeclares(customDeclare); + } + } + } + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public void addCustomMungerFactory(CustomMungerFactory factory) { + customMungerFactories.add(factory); + } +}