pointcut « aspectj « Java Enterprise Q&A

1. Is there a way to improve this pointcut?    stackoverflow.com

I have come up with the following pointcut that I use for tracing method entry/exit. It's not broken and also does what I want but: 1- I find it looks clumsy ...

2. Please suggest some tutorial for learning pointcut expression    stackoverflow.com

Please suggest some tutorial/cheatsheet for learning pointcut expression.

3. Define pointcut to capture an interface but not parent or sub interfaces    stackoverflow.com

I was wondering how to define a pointcut in aspecJ the captures any method of an interface but not the methods of any parent or sub interface.

pubic interface A {

4. AspectJ join point with simple types    stackoverflow.com

Are there defined join points in arithmetics that I can catch? Something like:

int a = 4;
int b = 2;
int c = a + b;
Can I make a pointcut that catches any one ...

5. AspectJ, general pointcuts without constructors    stackoverflow.com

I've made a profiling method:

@Around("tld.mycompany.business.aspects.SystemArchitecture.inServiceLayer() && !tld.mycompany.business.aspects.SystemArchitecture.publicConstructor()")
public Object profileBusiness(ProceedingJoinPoint pjp) throws Throwable {
 try {
    long start = System.currentTimeMillis();
    String name = pjp.getSourceLocation().toString() + " ...

6. AspectJ confusion with pointcut    stackoverflow.com

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 ...

7. Array element set pointcut. Is there a workaround?    stackoverflow.com

I just read that it is not possible to define a pointcut on a single array element (bug link). Considering I really need to detect an array element modification, ...

8. Define a pointcut on a member access and function call    stackoverflow.com

it's quite hard to explain but I want to define in AspectJ a pointcut upon the call of a function like this:

public class B{
    public A a;

public class ...

9. Aspect oriented question - Pointcut    stackoverflow.com

i'm wondering what the following means in a pointcut

after(FigureElement fe, int x, int y) returning:
        call(void FigureElement.setXY(int, int))

10. How do I write a unit test for an AspectJ pointcut on a Type where I need to mock that Type?    stackoverflow.com

I have written the following Aspect:

public aspect AuditAspect {
pointcut prepareStatement(String sql): call(PreparedStatement Connection.prepareStatement(..)) && args(sql);

Object around(String sql): prepareStatement(sql) {
    return proceed("<some storedproc call>; " + sql);
I would like ...

11. Aspectj : getting the @Pointcut details in @Aspect    stackoverflow.com

I have an aspect that is called for any of the pointcuts defined, similar to something like this:

@Around("pointcut1(request) || pointcut2(request) || pointcut3(request)")
public ModelAndView myAspect(ProceedingJoinPoint proceedingJp, 

12. Pointcut expression for argument in any position    stackoverflow.com

@Before(value = "@annotation(OwnershipCheck) && args(enquiry)")
public void checkOwnership(Enquiry enquiry) throws Throwable
The above expression will match for any method with the OwnershipCheck annotation and takes an enquiry as a parameter. How can I extend ...

13. About Policy Enforcement with AspectJ    stackoverflow.com

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 ...

14. Enforcing Naming Convention with aspects    stackoverflow.com

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 ...

15. aspectj pointcut execution example    stackoverflow.com

I want to match all methods that take an annotation parameter @NotNull, There can be one or more parameters and they have to be within a specific package. for example, it ...

16. Using interface in a within pointcut in aspectj    stackoverflow.com

Can we use a java interface in a within pointcut in aspectj and then specify a method declared in that interface in an execution pointcut?

before () : within (some java interface) ...

17. exposing previous value in AspectJ set-pointcut    stackoverflow.com

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

18. Pointcut for usage of operator "==" with specific types    stackoverflow.com

is it possible to write an AspectJ pointcut that matches the usage of a specific operator with a specific type? Some background information: I'm working on a project where we have to ...

19. AspectJ pointcut not working with external classes and LTW    stackoverflow.com

I am trying to use AspectJ (which until yesterday I didn’t know) with LTW in order to understand how an existing framework ( http://sourceforge.net/projects/ivalidator/ ) works. In brief, I ...