Change propagation, AspectJ

L

levente.meszaros

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top