Hello!,
It wanted to know if the following thing can be
done in AspectJ and like, or if on the contrary this characteristic is not
supported.
I have been able to verify that
it is possible to be acceded to the object of the join point from aspect, as
much with this, target or thisJoinPoint but seems to me that it is not possible
to be acceded to the fields, or objects that are declared within the join
point that is captured by point cut. I am in the correct thing or no, this is
tensile to the fields and objects that they declare in the captured object if
they are private. I am in the correct thing or no.
A problem that I have been at the time of
developing Aspects is the problem that exists in order to accede to the
information of other objects from an aspect, whenever this it is not the object
of the captured join point. I have seen solutions this problem as it
is example of Observer, but seems to me a forced solution to a problem,
since in the end us it forces to call to a method from a class, being that
this method does not exist in this class, and extends is added to him with '
declares parent....'
I talk about the following code of the class
Demo.java de Observer:
Display display = new
Display();
Button b1 = new
Button(display);
Button b2 = new
Button(display);
ColorLabel c1 =
new ColorLabel(display);
ColorLabel c2 = new
ColorLabel(display);
ColorLabel c3
= new ColorLabel(display);
b1.addObserver(c1);
b1.addObserver(c2);
<------------ I talk about these two lines.
We will be able to verify that in Button.java these methods do not exist,
since they have been provided from the SubjectObserverProtocolImpl aspect
extendiento the SubjectObserverProtocol aspect.
This forces to change the codification to us of the Demo.java class if we
want to use this class in another project without it is implemented is Observer
aspect.
Not if I will be in the certain thing or no, but if it lacks this
characteristic would be very useful the power to count on a primitive one to be
able to accede to these data in the style of thisJoinPoint.
I suppose that the solution will exist and I wait for your answer.