Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Filed set after constructor

Hi,
 
I'm introducing a new filed in a class and I want to set it after construtor runs. Somethig like this:
 
  // introduced field
  String AClass.expressao;

  // introduced method
  public String AClass.getExpressao() {
    return expressao;
  }

  pointcut pc() : call(AClass.new(..));

  after() : pc() {
    AClass ac = (AClass) thisJoinPoint.getTarget();
    ac.expressao = thisJoinPoint.getArgs()[0];
  }
 
But... thisJoinPoint.getTarget() returns null.
 
Is there a way to make it works?
 
Thanks,
 
Andre

Back to the top