diff options
author | Andy Clement <andrew.clement@gmail.com> | 2012-08-01 08:34:21 -0700 |
---|---|---|
committer | Andy Clement <andrew.clement@gmail.com> | 2012-08-01 08:34:21 -0700 |
commit | 993cef1c34849b5a3c92f5ddf4839ccf9047da77 (patch) | |
tree | 3b687f6cd596fd4a403ca48d2f027f30b7fc2425 /weaver/src | |
parent | 5378e48a474c14a59a2e0b76cf7404655f8875a7 (diff) | |
download | aspectj-993cef1c34849b5a3c92f5ddf4839ccf9047da77.tar.gz aspectj-993cef1c34849b5a3c92f5ddf4839ccf9047da77.zip |
386337: more missing support added to SimpleAOPParser
Diffstat (limited to 'weaver/src')
-rw-r--r-- | weaver/src/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/weaver/src/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java b/weaver/src/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java index 9c3c875b7..bcd6ddcd0 100644 --- a/weaver/src/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java +++ b/weaver/src/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java @@ -20,7 +20,9 @@ import java.util.Map; import java.util.Set; import org.aspectj.util.LangUtil; +import org.aspectj.weaver.loadtime.definition.Definition.AdviceKind; import org.aspectj.weaver.loadtime.definition.Definition.DeclareAnnotationKind; +import org.xml.sax.SAXException; /** * This class has been created to avoid deadlocks when instrumenting SAXParser. @@ -55,6 +57,9 @@ public class SimpleAOPParser { private static final String ANNO_KIND_TYPE = "type"; private static final String ANNO_KIND_METHOD = "method"; private static final String ANNO_KIND_FIELD = "field"; + private final static String BEFORE_ELEMENT = "before"; + private final static String AFTER_ELEMENT = "after"; + private final static String AROUND_ELEMENT = "around"; private final Definition m_definition; private boolean m_inAspectJ; private boolean m_inWeaver; @@ -182,6 +187,35 @@ public class SimpleAOPParser { } } + else if (BEFORE_ELEMENT.equals(qName) && m_inAspects ) { + String pointcut = (String) attrMap.get(POINTCUT_ELEMENT); + String adviceClass = (String) attrMap.get("invokeClass"); + String adviceMethod = (String) attrMap.get("invokeMethod"); + if (!isNull(pointcut) && !isNull(adviceClass) && !isNull(adviceMethod)) { + m_lastConcreteAspect.pointcutsAndAdvice.add(new Definition.PointcutAndAdvice(AdviceKind.Before, + replaceXmlAnd(pointcut), adviceClass, adviceMethod)); + } else { + throw new SAXException("Badly formed <before> element"); + } + } else if (AFTER_ELEMENT.equals(qName) && m_inAspects) { + String pointcut = (String) attrMap.get(POINTCUT_ELEMENT); + String adviceClass = (String) attrMap.get("invokeClass"); + String adviceMethod = (String) attrMap.get("invokeMethod"); + if (!isNull(pointcut) && !isNull(adviceClass) && !isNull(adviceMethod)) { + m_lastConcreteAspect.pointcutsAndAdvice.add(new Definition.PointcutAndAdvice(AdviceKind.After, + replaceXmlAnd(pointcut), adviceClass, adviceMethod)); + } else { + throw new SAXException("Badly formed <after> element"); + } + } else if (AROUND_ELEMENT.equals(qName) && m_inAspects) { + String pointcut = (String) attrMap.get(POINTCUT_ELEMENT); + String adviceClass = (String) attrMap.get("invokeClass"); + String adviceMethod = (String) attrMap.get("invokeMethod"); + if (!isNull(pointcut) && !isNull(adviceClass) && !isNull(adviceMethod)) { + m_lastConcreteAspect.pointcutsAndAdvice.add(new Definition.PointcutAndAdvice(AdviceKind.Around, + replaceXmlAnd(pointcut), adviceClass, adviceMethod)); + } + } else { throw new Exception( "Unknown element while parsing <aspectj> element: " + qName); |