Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] IDT - separating getter/setter from beans

This is actually what Spring Roo does (well one of the things).  If
you are using Roo and mark your class with the RooJavaBean annotation
it will create and maintain the aspect definitions for you.

Oh, and one other thing - if your field is private in the target then
you will need to make the aspect a 'privileged' aspect, so that the
ITDs can access the field on the target.

cheers
Andy

On 26 May 2010 06:24, Simone Gianni <simoneg@xxxxxxxxxx> wrote:
> Hi Roger,
> yes, you can do it, but you have to specify to which class you are attaching
> them :
>
> public aspect MyTestBeanSupport {
>
>    public void MyTest.setData1(String data) {
>        this.data1 = data1;
>    }
>
>    public Strng MyTest.getData1() {
>        return data1;
>    }
>
> }
>
> Simone
>
>
> 2010/5/26 Roger Gilliar <roger@xxxxxxxxxx>
>>
>> Is it possible to separate the getter setters into an aspect ?
>>
>> I tried to use static aspect Pmpl to introduce the getter setters but they
>> can't access the variables defined in the main class.
>>
>> Something like
>>
>> public class MyTest() {
>>    String data1;
>> }
>>
>>
>> public aspect MyTestBeanSupport {
>>
>>    public void setData1(String data) {
>>        this.data1 = data1;
>>    }
>>
>>    public Strng getData1() {
>>        return data1;;
>>    }
>>
>> }
>>
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top