aboutsummaryrefslogtreecommitdiffstats
path: root/aspectj5rt/java5-src/org/aspectj/lang
diff options
context:
space:
mode:
Diffstat (limited to 'aspectj5rt/java5-src/org/aspectj/lang')
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/Advice.java23
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/AdviceKind.java (renamed from aspectj5rt/java5-src/org/aspectj/lang/reflect/AdviceType.java)5
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/AjType.java315
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/AjTypeSystem.java34
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareAnnotation.java2
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareErrorOrWarning.java21
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareParents.java29
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclarePrecedence.java16
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareSoft.java18
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/NoSuchAdviceException.java7
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/NoSuchPointcutException.java7
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/PerClause.java8
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/PerClauseKind.java4
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/Pointcut.java31
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/PointcutBasedPerClause.java25
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/PointcutExpression.java2
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/SignaturePattern.java23
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/TypePattern.java22
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/reflect/TypePatternBasedPerClause.java26
19 files changed, 531 insertions, 87 deletions
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/Advice.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/Advice.java
index 4792a3ba9..581c5a5fb 100644
--- a/aspectj5rt/java5-src/org/aspectj/lang/reflect/Advice.java
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/Advice.java
@@ -11,11 +11,32 @@
* ******************************************************************/
package org.aspectj.lang.reflect;
+/**
+ * Runtime representation of an advice declaration inside an aspect
+ */
public interface Advice {
- AdviceType getKind();
+ /**
+ * The declaring aspect
+ */
+ AjType getDeclaringType();
+ /**
+ * The kind of advice (before, after-returning, after-throwing, etc.)
+ */
+ AdviceKind getKind();
+
+ /**
+ * Returns the advice name, or the empty string if the advice is anonymous.
+ * If using the @AspectJ annotations, the advice name is the name of the
+ * annotated advice method. If using the code style, the advice is
+ * anonymous, unless the advice is annotated with the @AdviceName annotation,
+ * in which case the name given in the annotation is returned.
+ */
String getName();
+ /**
+ * The pointcut expression associated with the advice declaration.
+ */
PointcutExpression getPointcutExpression();
}
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/AdviceType.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/AdviceKind.java
index 541334853..82351db88 100644
--- a/aspectj5rt/java5-src/org/aspectj/lang/reflect/AdviceType.java
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/AdviceKind.java
@@ -12,10 +12,9 @@
package org.aspectj.lang.reflect;
/**
- * The different types of advice in AspectJ
- *
+ * The different kinds of advice in AspectJ
*/
-public enum AdviceType {
+public enum AdviceKind {
BEFORE,
AFTER,
AFTER_RETURNING,
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/AjType.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/AjType.java
index 095db2172..e2db1407f 100644
--- a/aspectj5rt/java5-src/org/aspectj/lang/reflect/AjType.java
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/AjType.java
@@ -11,7 +11,7 @@
* ******************************************************************/
package org.aspectj.lang.reflect;
-import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -22,160 +22,359 @@ import java.lang.reflect.TypeVariable;
* The runtime representation of a type (Aspect, Class, Interface, Annotation, Enum, or Array) in an AspectJ
* program.
*/
-public interface AjType<T> extends Type {
+public interface AjType<T> extends Type, AnnotatedElement {
+ /**
+ * The name of this type, in the same format as returned by Class.getName()
+ */
public String getName();
+ /**
+ * The package in which this type is declared
+ */
public Package getPackage();
- public Class[] getInterfaces();
+ /**
+ * The interfaces implemented by this type
+ */
+ public AjType<?>[] getInterfaces();
+ /**
+ * The modifiers declared for this type. The return value can be interpreted
+ * using java.lang.reflect.Modifier
+ */
public int getModifiers();
+
+ /**
+ * The java.lang.Class that corresponds to this AjType
+ */
+ public Class<T> getJavaClass();
// scope
- public AjType getSupertype();
+ /**
+ * The supertype of this type. If this type represents Object or a primitive type
+ * then null is returned.
+ */
+ public AjType<?> getSupertype();
+ /**
+ * The generic supertype of this type, as defined by Class.getGenericSupertype
+ */
public Type getGenericSupertype();
+ /**
+ * If this type represents a local or anonymous type declared within a method, return
+ * then enclosing Method object.
+ */
public Method getEnclosingMethod();
+ /**
+ * If this type represents a local or anonymous type declared within a constructor, return
+ * then enclosing Method object.
+ */
public Constructor getEnclosingConstructor();
- public AjType getEnclosingType();
-
- public AjType getDeclaringType();
+ /**
+ * Returns the immediately enclosing type of this type.
+ */
+ public AjType<?> getEnclosingType();
+
+ /**
+ * If this type is a member of another type, return the AjType representing the type
+ * in which it was declared.
+ */
+ public AjType<?> getDeclaringType();
+ /**
+ * If this type represents an aspect, returns the associated per-clause.
+ * Returns null for non-aspect types.
+ */
public PerClause getPerClause();
- // annotations
-
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType);
-
- public <A extends Annotation> A getAnnotation(Class<A> annotationType);
-
- public Annotation[] getAnnotations();
-
- public Annotation[] getDeclaredAnnotations();
-
// inner types
+ /**
+ * Returns an array containing all the public types that are members of this type
+ */
+ public AjType<?>[] getAjTypes();
- public AjType[] getAjTypes();
-
- public AjType[] getDeclaredAjTypes();
+ /**
+ * Returns an array containing all the types declared by this type
+ */
+ public AjType<?>[] getDeclaredAjTypes();
// constructors
- public Constructor getConstructor(Class... parameterTypes) throws NoSuchMethodException;
+ /**
+ * Returns the constructor object for the specified public constructor of this type
+ */
+ public Constructor getConstructor(AjType<?>... parameterTypes) throws NoSuchMethodException;
+ /**
+ * Returns all of the public constructors of this type
+ */
public Constructor[] getConstructors();
- public Constructor getDeclaredConstructor(Class... parameterTypes) throws NoSuchMethodException;
-
+ /**
+ * Returns the constructor object for the specified constructor of this type
+ */
+ public Constructor getDeclaredConstructor(AjType<?>... parameterTypes) throws NoSuchMethodException;
+
+ /**
+ * Returns all the constructors declared in this type
+ */
public Constructor[] getDeclaredConstructors();
// fields
+ /**
+ * Return the field declared in this type with the given name
+ */
public Field getDeclaredField(String name) throws NoSuchFieldException;
+ /**
+ * Returns all the fields declared in this type
+ */
public Field[] getDeclaredFields();
+ /**
+ * Return the public field with the given name
+ */
public Field getField(String name) throws NoSuchFieldException;
+ /**
+ * Return the public fields declared by this type
+ */
public Field[] getFields();
// methods
-
- public Method getDeclaredMethod(String name, Class... parameterTypes) throws NoSuchMethodException;
-
- public Method getMethod(String name, Class... parameterTypes) throws NoSuchMethodException;
-
+
+ /**
+ * Return the method object for the specified method declared in this type
+ */
+ public Method getDeclaredMethod(String name, AjType<?>... parameterTypes) throws NoSuchMethodException;
+
+ /**
+ * Return the method object for the specified public method declared in this type
+ */
+ public Method getMethod(String name, AjType<?>... parameterTypes) throws NoSuchMethodException;
+
+ /**
+ * Return all the methods declared by this type
+ */
public Method[] getDeclaredMethods();
+ /**
+ * Returns all the public methods of this type
+ */
public Method[] getMethods();
// pointcuts
+ /**
+ * Return the pointcut object representing the specified pointcut declared by this type
+ */
public Pointcut getDeclaredPointcut(String name) throws NoSuchPointcutException;
+ /**
+ * Return the pointcut object representing the specified public pointcut
+ */
public Pointcut getPointcut(String name) throws NoSuchPointcutException;
-
+
+ /**
+ * Returns all of the pointcuts declared by this type
+ */
public Pointcut[] getDeclaredPointcuts();
-
+
+ /**
+ * Returns all of the public pointcuts of this type
+ */
public Pointcut[] getPointcuts();
// advice
-
- public Advice[] getDeclaredAdvice(AdviceType... ofTypes);
-
- public Advice[] getAdvice(AdviceType... ofTypes);
-
+
+ /**
+ * Returns all of the advice declared by this type, of an advice kind contained in the
+ * parameter list.
+ */
+ public Advice[] getDeclaredAdvice(AdviceKind... ofTypes);
+
+ /**
+ * Returns all of the advice for this type, of an advice kind contained in the parameter
+ * list.
+ */
+ public Advice[] getAdvice(AdviceKind... ofTypes);
+
+ /**
+ * Returns the advice with the given name. For an @AspectJ declared advice member,
+ * this is the name of the annotated method. For a code-style advice declaration, this
+ * is the name given in the @AdviceName annotation if present.
+ */
public Advice getAdvice(String name) throws NoSuchAdviceException;
+ /**
+ * Returns the advice declared in this type with the given name. For an @AspectJ declared advice member,
+ * this is the name of the annotated method. For a code-style advice declaration, this
+ * is the name given in the @AdviceName annotation if present.
+ */
public Advice getDeclaredAdvice(String name) throws NoSuchAdviceException;
// inter-type declarations
- public InterTypeMethodDeclaration getDeclaredITDMethod(String name, Class target, Class... parameterTypes);
+ /**
+ * Return the inter-type method declared by this type matching the given specification
+ */
+ public InterTypeMethodDeclaration getDeclaredITDMethod(String name, AjType<?> target, AjType<?>... parameterTypes);
+ /**
+ * Return all of the inter-type methods declared by this type
+ */
public InterTypeMethodDeclaration[] getDeclaredITDMethods();
-
- public InterTypeMethodDeclaration getITDMethod(String name, Class target, Class... parameterTypes);
-
+
+ /**
+ * Return the public inter-type method of this type matching the given specification
+ */
+ public InterTypeMethodDeclaration getITDMethod(String name, AjType<?> target, AjType<?>... parameterTypes);
+
+ /**
+ * Return all of the public inter-type declared methods of this type
+ */
public InterTypeMethodDeclaration[] getITDMethods();
- public InterTypeConstructorDeclaration getDeclaredITDConstructor(Class target, Class... parameterTypes);
-
+ /**
+ * Return the inter-type constructor declared by this type matching the given specification
+ */
+ public InterTypeConstructorDeclaration getDeclaredITDConstructor(AjType<?> target, AjType<?>... parameterTypes);
+
+ /**
+ * Returns all of the inter-type constructors declared by this type
+ */
public InterTypeConstructorDeclaration[] getDeclaredITDConstructors();
- public InterTypeConstructorDeclaration getITDConstructor(Class target, Class... parameterTypes);
-
+ /**
+ * Return the public inter-type constructor matching the given specification
+ */
+ public InterTypeConstructorDeclaration getITDConstructor(AjType<?> target, AjType<?>... parameterTypes);
+
+ /**
+ * Return all of the public inter-type constructors of this type
+ */
public InterTypeConstructorDeclaration[] getITDConstructors();
-
- public InterTypeFieldDeclaration getDeclaredITDField(String name, Class target);
-
+
+ /**
+ * Return the inter-type field declared in this type with the given specification
+ */
+ public InterTypeFieldDeclaration getDeclaredITDField(String name, AjType<?> target);
+
+ /**
+ * Return all of the inter-type fields declared in this type
+ */
public InterTypeFieldDeclaration[] getDeclaredITDFields();
-
- public InterTypeFieldDeclaration getITDField(String name, Class target);
-
+
+ /**
+ * Return the public inter-type field matching the given specification
+ */
+ public InterTypeFieldDeclaration getITDField(String name, AjType<?> target);
+
+ /**
+ * Return all of the public inter-type fields for this type
+ */
public InterTypeFieldDeclaration[] getITDFields();
// declare statements
-
+ /**
+ * Returns all of the declare error and declare warning members of this type,
+ * including declare error/warning members inherited from super-types
+ */
public DeclareErrorOrWarning[] getDeclareErrorOrWarnings();
+ /**
+ * Returns all of the declare parents members of this type, including
+ * declare parent members inherited from super-types
+ */
public DeclareParents[] getDeclareParents();
+ /**
+ * Return all of the declare soft members of this type, including declare
+ * soft members inherited from super-types
+ */
public DeclareSoft[] getDeclareSofts();
-
+
+ /**
+ * Return all of the declare annotation members of this type, including declare
+ * annotation members inherited from super-types
+ */
public DeclareAnnotation[] getDeclareAnnotations();
+ /**
+ * Return all of the declare precedence members of this type, including declare
+ * precedence members inherited from super-types
+ */
public DeclarePrecedence[] getDeclarePrecedence();
// misc
+ /**
+ * Returns the elements of this enum class, or null if this type does not represent
+ * an enum type.
+ */
public T[] getEnumConstants();
+ /**
+ * Returns an array of TypeVariable objects that represent the type variables declared by
+ * this type (if any)
+ */
public TypeVariable<Class<T>>[] getTypeParameters();
-
+
+ /**
+ * True if this is an enum type
+ */
public boolean isEnum();
-
+
+ /**
+ * True if the given object is assignment-compatible with an object of the type represented
+ * by this AjType
+ */
public boolean isInstance(Object o);
-
+
+ /**
+ * True if this is an interface type
+ */
public boolean isInterface();
-
+
+ /**
+ * Returns true if and only if the underlying type is a local class
+ */
public boolean isLocalClass();
+ /**
+ * Returns true if and only if the underlying type is a member class
+ */
public boolean isMemberClass();
+ /**
+ * Return true if this is an array type
+ */
public boolean isArray();
-
+
+ /**
+ * Return true if this object represents a primitive type
+ */
public boolean isPrimitive();
-
+
+ /**
+ * Return true if this is an aspect type
+ */
public boolean isAspect();
+ /**
+ * Returns true if and only if the underlying type is a member aspect
+ */
public boolean isMemberAspect();
-
+
+ /**
+ * Returns true if and only if the underlying type is a privileged aspect
+ */
public boolean isPrivileged();
}
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/AjTypeSystem.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/AjTypeSystem.java
index 7b1599549..fbd9a6644 100644
--- a/aspectj5rt/java5-src/org/aspectj/lang/reflect/AjTypeSystem.java
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/AjTypeSystem.java
@@ -11,15 +11,43 @@
* ******************************************************************/
package org.aspectj.lang.reflect;
+import java.lang.ref.WeakReference;
+import java.util.Map;
+import java.util.WeakHashMap;
+
import org.aspectj.internal.lang.reflect.AjTypeImpl;
/**
- * @author colyer
- *
+ * This is the anchor for the AspectJ runtime type system.
+ * Typical usage to get the AjType representation of a given type
+ * at runtime is to call <code>AjType<Foo> fooType = AjTypeSystem.getAjType(Foo.class);</code>
*/
public class AjTypeSystem {
+
+ private static Map<Class, WeakReference<AjType>> ajTypes = new WeakHashMap<Class,WeakReference<AjType>>();
+ /**
+ * Return the AspectJ runtime type representation of the given Java type.
+ * Unlike java.lang.Class, AjType understands pointcuts, advice, declare statements,
+ * and other AspectJ type members. AjType is the recommended reflection API for
+ * AspectJ programs as it offers everything that java.lang.reflect does, with
+ * AspectJ-awareness on top.
+ */
public static <T> AjType<T> getAjType(Class<T> fromClass) {
- return new AjTypeImpl<T>(fromClass);
+ if (ajTypes.containsKey(fromClass)) {
+ WeakReference<AjType> weakRefToAjType = ajTypes.get(fromClass);
+ AjType<T> theAjType = weakRefToAjType.get();
+ if (theAjType != null) {
+ return theAjType;
+ } else {
+ theAjType = new AjTypeImpl<T>(fromClass);
+ ajTypes.put(fromClass, new WeakReference<AjType>(theAjType));
+ return theAjType;
+ }
+ }
+ // neither key nor value was found
+ AjType<T> theAjType = new AjTypeImpl<T>(fromClass);
+ ajTypes.put(fromClass, new WeakReference<AjType>(theAjType));
+ return theAjType;
}
}
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareAnnotation.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareAnnotation.java
index cd594e9da..4e0f78aa7 100644
--- a/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareAnnotation.java
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareAnnotation.java
@@ -12,7 +12,7 @@
package org.aspectj.lang.reflect;
/**
- * @author colyer
+ * The AspectJ runtime representation of a declare annotation member in an aspect.
*
*/
public interface DeclareAnnotation {
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareErrorOrWarning.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareErrorOrWarning.java
index c8539c166..a6a5abc53 100644
--- a/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareErrorOrWarning.java
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareErrorOrWarning.java
@@ -12,12 +12,29 @@
package org.aspectj.lang.reflect;
/**
- * @author colyer
- *
+ * AspectJ runtime representation of a declare error or declare warning member
+ * in an aspect.
*/
public interface DeclareErrorOrWarning {
+
+ /**
+ * The type that declared this declare warning or declare error member.
+ */
+ AjType getDeclaringType();
+
+ /**
+ * The pointcut expression associated with the warning or error
+ */
PointcutExpression getPointcutExpression();
+
+ /**
+ * The message associated with the declare warning / declare error
+ */
String getMessage();
+
+ /**
+ * True if this is a declare error member, false if it is declare warning
+ */
boolean isError();
}
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareParents.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareParents.java
index 6b1d6f5b3..f8ee5c99d 100644
--- a/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareParents.java
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareParents.java
@@ -12,9 +12,34 @@
package org.aspectj.lang.reflect;
/**
- * @author colyer
- *
+ * A declare parents member defined inside an aspect
*/
public interface DeclareParents {
+ /**
+ * The declaring aspect
+ */
+ AjType getDeclaringType();
+
+ /**
+ * The target type pattern
+ */
+ TypePattern getTargetTypesPattern();
+
+ /**
+ * True if this is a declare parents...extends member declaration
+ */
+ boolean isExtends();
+
+ /**
+ * True if this is a declare parents...implements member declaration
+ */
+ boolean isImplements();
+
+ /**
+ * The set of types that the types matching getTargetTypesPattern are
+ * declared to implement or extend
+ */
+ AjType[] getParentTypes();
+
}
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclarePrecedence.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclarePrecedence.java
index ad7086d95..894580b70 100644
--- a/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclarePrecedence.java
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclarePrecedence.java
@@ -12,9 +12,21 @@
package org.aspectj.lang.reflect;
/**
- * @author colyer
- *
+ * AspectJ runtime representation of a declare precedence statement as
+ * declared in an aspect.
*/
public interface DeclarePrecedence {
+ /**
+ * The declaring aspect
+ */
+ AjType getDeclaringType();
+
+ /**
+ * Returns an ordered set of type patterns. An aspect matching
+ * a type pattern at a lower index in the array takes precedence
+ * over an aspect that only matches a type pattern at a higher
+ * index in the array.
+ */
+ TypePattern[] getPrecedenceOrder();
}
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareSoft.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareSoft.java
index ffb392c3f..b397c94f3 100644
--- a/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareSoft.java
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/DeclareSoft.java
@@ -12,9 +12,23 @@
package org.aspectj.lang.reflect;
/**
- * @author colyer
- *
+ * AspectJ runtime representation of a declare soft member within an aspect.
*/
public interface DeclareSoft {
+
+ /**
+ * The aspect that declared this member
+ */
+ AjType getDeclaringType();
+
+ /**
+ * The softened exception type
+ */
+ AjType getSoftenedExceptionType();
+
+ /**
+ * The pointcut determining the join points at which the exception is to be softened.
+ */
+ PointcutExpression getPointcutExpression();
}
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/NoSuchAdviceException.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/NoSuchAdviceException.java
index e14dfb7d3..6b1ca8fa0 100644
--- a/aspectj5rt/java5-src/org/aspectj/lang/reflect/NoSuchAdviceException.java
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/NoSuchAdviceException.java
@@ -12,8 +12,8 @@
package org.aspectj.lang.reflect;
/**
- * @author colyer
- *
+ * Thrown when AjType.getDeclaredAdvice is called with an advice name and no matching
+ * advice declaration can be found.
*/
public class NoSuchAdviceException extends Exception {
@@ -24,6 +24,9 @@ public class NoSuchAdviceException extends Exception {
this.name = name;
}
+ /**
+ * The advice name that could not be found.
+ */
public String getName() {
return name;
}
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/NoSuchPointcutException.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/NoSuchPointcutException.java
index df1bf9189..0274b74b4 100644
--- a/aspectj5rt/java5-src/org/aspectj/lang/reflect/NoSuchPointcutException.java
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/NoSuchPointcutException.java
@@ -12,8 +12,8 @@
package org.aspectj.lang.reflect;
/**
- * @author colyer
- *
+ * Thrown when AjType.getDeclaredPointcut is called with a pointcut name, and no
+ * matching pointcut declaration can be found.
*/
public class NoSuchPointcutException extends Exception {
@@ -24,6 +24,9 @@ public class NoSuchPointcutException extends Exception {
this.name = name;
}
+ /**
+ * The name of the pointcut that could not be found.
+ */
public String getName() {
return name;
}
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/PerClause.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/PerClause.java
index c3396c548..c16feda33 100644
--- a/aspectj5rt/java5-src/org/aspectj/lang/reflect/PerClause.java
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/PerClause.java
@@ -12,10 +12,12 @@
package org.aspectj.lang.reflect;
/**
- * @author colyer
- *
+ * AspectJ runtime representation of the per-clause associated with an aspect.
*/
public interface PerClause {
+ /**
+ * The kind of per-clause (singleton, perthis, pertarget,...)
+ */
PerClauseKind getKind();
- PointcutExpression getPointcutExpression();
+
}
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/PerClauseKind.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/PerClauseKind.java
index 03313d8c5..1e2d42ecd 100644
--- a/aspectj5rt/java5-src/org/aspectj/lang/reflect/PerClauseKind.java
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/PerClauseKind.java
@@ -12,8 +12,8 @@
package org.aspectj.lang.reflect;
/**
- * @author colyer
- * The different perclauses (aspect instantiation models)
+ * The different per-clauses (aspect instantiation models)
+ * supported by AspectJ
*/
public enum PerClauseKind {
SINGLETON,
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/Pointcut.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/Pointcut.java
index c514bea01..dfec7ccbd 100644
--- a/aspectj5rt/java5-src/org/aspectj/lang/reflect/Pointcut.java
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/Pointcut.java
@@ -11,17 +11,42 @@
* ******************************************************************/
package org.aspectj.lang.reflect;
+/**
+ * AspectJ runtime representation of a pointcut member inside a class or aspect.
+ */
public interface Pointcut {
-
- PointcutExpression getPointcutExpression();
+ /**
+ * The declared name of the pointcut.
+ */
String getName();
+ /**
+ * The modifiers associated with the pointcut declaration.
+ * Use java.lang.reflect.Modifier to interpret the return value
+ */
int getModifiers();
- Class<?>[] getParameterTypes();
+ /**
+ * The pointcut parameter types.
+ */
+ AjType<?>[] getParameterTypes();
+ /**
+ * The pointcut parameter names. Returns an array of empty strings
+ * of length getParameterTypes().length if parameter names are not
+ * available at runtime.
+ */
String[] getParameterNames();
+ /**
+ * The type that declared this pointcut
+ */
AjType getDeclaringType();
+
+ /**
+ * The pointcut expression associated with this pointcut.
+ */
+ PointcutExpression getPointcutExpression();
+
}
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/PointcutBasedPerClause.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/PointcutBasedPerClause.java
new file mode 100644
index 000000000..db040ea62
--- /dev/null
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/PointcutBasedPerClause.java
@@ -0,0 +1,25 @@
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer Initial implementation
+ * ******************************************************************/
+package org.aspectj.lang.reflect;
+
+/**
+ * Representation of a pointcut based per-clause associated with an aspect
+ * (perthis/target/cflow/cflowbelow)
+ *
+ */
+public interface PointcutBasedPerClause extends PerClause {
+
+ /**
+ * Get the associated pointcut expression
+ */
+ PointcutExpression getPointcutExpression();
+}
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/PointcutExpression.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/PointcutExpression.java
index b2ab44d7c..e229ba1f0 100644
--- a/aspectj5rt/java5-src/org/aspectj/lang/reflect/PointcutExpression.java
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/PointcutExpression.java
@@ -20,5 +20,5 @@ public interface PointcutExpression {
/**
* Returns a String representation of the pointcut expression
*/
- String toString();
+ String asString();
}
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/SignaturePattern.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/SignaturePattern.java
new file mode 100644
index 000000000..99ba44dda
--- /dev/null
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/SignaturePattern.java
@@ -0,0 +1,23 @@
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer Initial implementation
+ * ******************************************************************/
+package org.aspectj.lang.reflect;
+
+/**
+ * AspectJ runtime representation of a signature pattern as used in various
+ * aspect members (for example, declare @method, declare @field).
+ */
+public interface SignaturePattern {
+
+ /** return a String representation of this pattern */
+ String asString();
+
+}
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/TypePattern.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/TypePattern.java
new file mode 100644
index 000000000..f3b69b421
--- /dev/null
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/TypePattern.java
@@ -0,0 +1,22 @@
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer Initial implementation
+ * ******************************************************************/
+package org.aspectj.lang.reflect;
+
+/**
+ * AspectJ runtime representation of a type pattern as used in member declarations
+ * such as declare parents.
+ */
+public interface TypePattern {
+
+ /** a string representation of the pattern */
+ String asString();
+}
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/reflect/TypePatternBasedPerClause.java b/aspectj5rt/java5-src/org/aspectj/lang/reflect/TypePatternBasedPerClause.java
new file mode 100644
index 000000000..402b883b9
--- /dev/null
+++ b/aspectj5rt/java5-src/org/aspectj/lang/reflect/TypePatternBasedPerClause.java
@@ -0,0 +1,26 @@
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer Initial implementation
+ * ******************************************************************/
+package org.aspectj.lang.reflect;
+
+/**
+ * AspectJ runtime representation of a type pattern based per-clause associated
+ * with an aspect (pertypewithin).
+ *
+ */
+public interface TypePatternBasedPerClause {
+
+ /**
+ * Get the associated type pattern
+ */
+ TypePattern getTypePattern();
+
+}