[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[aspectj-users] Change propagation, AspectJ More options
|
- From: "Levente Mészáros" <levente.meszaros@xxxxxxxxx>
- Date: Fri, 13 Apr 2007 17:20:22 +0200
- Delivered-to: aspectj-users@eclipse.org
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=d6t9LpLTpsTuVK2iEK88XDc1AZy5UYRVAM3srC21LO1/vanJxE3/sYCgadVSnI0d8yPn1bcxxGQlj3hBQyERRroe9EnbuUOaMIPr9RtQONRsGND97amdq1GjwMLo+VDhRE286ugcrRdnyvPaS2aUpexmglvMn8iVSURvU4+6MK0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Kr8pDYtUuf4LJzKwOH05rzGKCDUAYvsR8NSfw2dmgD1uZcDQYleAxE31ztyMhviAJLK96PRIh5il0tMBxovqK9nD3vSAhlIfAeFh5wz42VvX8Y9oiroLuJgCvQ3dOPbLl4i4Gl/KTRl70ol5dZYncWNA69Lk4zBIoKgrOYo79AI=
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