[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Change propagation, AspectJ More options

Hi,

I don't know much about AspectJ, but I'm wondering about something in
Java like this one at http://common-lisp.net/project/computed-class.


Is it possible to write some AspectJ code (and add some pointcuts, etc.) to transform:


public Integer a;


into:


private ComputedState<Integer> aState = new ComputedState<Integer>();


public Integer getA() { return aState.getValue(); }


public void setA(int a) { aState.setValue(a); }


and transform:


public Integer getB() { return getA() + 1; }


into:


private ComputedState<Integer> bState;


public int getB() { return bState.recomputeIfInvalidAs(new IComputation() { public Object compute() { return getA() + 1; } }); }


The rest is simple and could be done in Java too and may eliminate lots of listeners...

levy


-- There's no perfectoin