reflection « aspectj « Java Enterprise Q&A

1. How do I intercept a method invocation with standard java features (no AspectJ etc)?

I want to intercept all method invocations to some class MyClass to be able to react on some setter-invocations. I tried to use dynamic proxies, but as far as I know, this ...

2. How-to programatically access private members trough privileged Aspect in AspectJ?

I was wondering if it was possible in AspectJ to do the following. I’m adding a method .inspect() to every object of class RubyObject. That method is supposed to spit a ...

3. Insert code into a method - Java

Is there a way to automatically insert code into a method? I have the following typical field with a getter and setter and I would like to insert the indicated code into ...

4. Unable to retrieve private annotation via reflection from aspectj advice

I have an annotation, defined as so:

public @interface RestletResourceVariable {
    String name(); 
I have a restlet ServerResource defined as so:
public class QuestionResource extends ServerResource {

5. Pointcut matching methods which have been annotated directly or in an inherited interface?

Consider this @PointCut which gets triggered if a method is annotated with an @Secure annotation:

@Pointcut("execution(@Secure * *(..)) && @annotation(secure)")
public void accessOperation(final Access access) { }
This works perfectly well for methods like:
class ...