Questions tagged [pointcuts]
37 questions
20
votes
3 answers
@AspectJ pointcut for methods that override an interface method with an annotation
How can I write an aspectj pointcut that applies to method executions which override an interface method with an annotation? For example:
interface A {
@MyAnnotation void method();
}
class B implements A {
void method();
}
The pointcut…

Dr. Hans-Peter Störr
- 25,298
- 30
- 102
- 139
10
votes
3 answers
exposing previous value in AspectJ set-pointcut
I have to detect fields value changes. I want to compare the previous value with the new one. I don't know the field name or its type. (More background here.) For sample given class:
package…

zacheusz
- 8,750
- 3
- 36
- 60
9
votes
2 answers
Spring aop pointcut expression to access method return type
I have a service interface with many methods, all of which take a Request object and return a Response object. All request objects have a common ancestor and all response objects have a different common ancestor (which has a success flag and a…

Sean Patrick Floyd
- 292,901
- 67
- 465
- 588
8
votes
2 answers
AspectJ : Issue when combining multiple pointcuts in @Around advice
I'm a beginner in AspectJ so please guide me to resolve the issue happening as per the below approach.
@Aspect
public class TestAop {
@Pointcut("execution(public * com.packg.foo.ClassOne.*(..))")
public void fooPoint()
…

mdparthi
- 123
- 1
- 2
- 6
6
votes
2 answers
AspectJ: How to get pointcuts to advise classes located in other projects
This should be simple.
Question
How do you get a pointcut in one project to advise the code/classes within another project?
Context
I'm working in eclipse with two projects. For ease of explanation, let's call one science project and the other…

gMale
- 17,147
- 17
- 91
- 116
5
votes
3 answers
Please suggest some tutorial for learning pointcut expression
Please suggest some tutorial/cheatsheet for learning pointcut expression.

Rakesh Juyal
- 35,919
- 68
- 173
- 214
4
votes
2 answers
Pointcuts and Aspect-Oriented Programming
How are pointcuts used in aspect-oriented programming language to add functionality into an existing program?
To my understanding, from this Wikipedia article - http://en.wikipedia.org/wiki/Pointcut
Pointcuts are placed into a specific spot in a…

Bobby S
- 4,006
- 9
- 42
- 61
4
votes
1 answer
AspectJ confusion with pointcut
How can I express a point cut that finds methods only when being called from within another method, but not directly?
For example:
Foo() calls Bar() calls object.Method()
also
NotFoo() calls Bar() calls object.Method()
I only want the pointcut to…

esiegel
- 1,773
- 2
- 19
- 31
4
votes
1 answer
Trying to match an AspectJ pointcut signature for any methods containing a variable
I want to create a pointcut that matches any method in my Web controller that contains a ModelMap:
pointcut addMenu(ModelMap modelMap) :
execution (public String example.web.MyController.*(..)) && args (modelMap);
before(ModelMap modelMap) :…

seanhodges
- 17,426
- 15
- 71
- 93
3
votes
1 answer
Reading and understanding AspectJ pointcuts?
/* 0 */ pointcut services(Server s): target(s) && call(public * *(..))
This pointcut, named services, picks out those points in the execution
of the program when Server objects have their public methods called.
It also allows anyone using the…

Christian
- 6,070
- 11
- 53
- 103
3
votes
2 answers
spring AoP, pointcut expression for overloaded methods with same parameter types
I've defined a class for CRUD operations on comments. The read method is overloaded.
class Comment{
// method 1: returns all the comments by a user
findAll(long userId, long subjectId, String param);
// method 2: returns all the…

Tushar Mishra
- 1,370
- 1
- 12
- 20
2
votes
1 answer
Using conditional join points in spring
How do we use conditional join points in spring
In my requirement, the point cut has to be applied if the method name is insert OR the method name is update OR method name is delete AND the method should have exactly three arguments
This was the…

Vinoth Kumar C M
- 10,378
- 28
- 89
- 130
2
votes
1 answer
UnsupportedPointcutPrimitiveException on simple AOP example
I try to run a simple aop example in this site. I have spring aop and aspectj, aspectjweaver jars:
@Aspect
public class StringAspect {
@Pointcut("call(* String.toLowerCase())")
public void toLowerCasePointcut() {}
…

asyard
- 1,743
- 5
- 21
- 43
2
votes
2 answers
Enforcing Naming Convention with aspects
I just started AspectJ in university and in one of the labs we have a question where we need to enforce a naming convention across all classes which states that all variables must not include any numbers, i.e. if I create a variable called test1 it…

John
- 4,413
- 6
- 25
- 28
2
votes
1 answer
About Policy Enforcement with AspectJ
I am using Aspectj for project-wide policy enforcement.
One thing I am trying to implement now is that there should be no logic in any setter methods except simple validation with Guava's Preconditions.check* methods.
public pointcut withinSetter()…

Sean Patrick Floyd
- 292,901
- 67
- 465
- 588