Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re : [aspectj-users] Limiting declare @field to classes/aspects

Hi Andy,

Sorry to go back to this issue after a long time.
You were right, I meant declare @field  * Flight.* : @MyAnnotation.

I would like to know if there is a workaround or another way to capture all ITD 
fields introduced by an aspect ?

Otherwise, I'll open a request enhancement as you suggested below.

Cheers,
Anwar.


----- Message d'origine ----
De : Andy Clement <andrew.clement@xxxxxxxxx>
À : aspectj-users@xxxxxxxxxxx
Envoyé le : Ven 4 juin 2010, 20h 17min 50s
Objet : Re: [aspectj-users] Limiting declare @field to classes/aspects

Hi,

I guess you didn't mean:

declare @type : *Flight : @MyAnnotation;

you meant:

declare @field: * *Flight.*: @MyAnnotation;

because you said you were adding annotations to all fields.

However, you still can't do what you want I'm afraid.  Although I
can't really think why not as what you are proposing doesn't seem
unreasonable.  Worth raising an enhancement request for that I think.

Andy



On 2 June 2010 12:39, Rizal Anwar <anrizal05@xxxxxxxx> wrote:
>
> I have the following use case:
> I want to add annotation using declare @field. For example, I have a class
> public class Flight {
> private String number;
> private String airline;
> private String departureAirport;
> private String arrivalAirport;
>  private Date departureTime;
>
> private Date arrivalTime;
> ...
> }
> I want to add annotations to all fields, let's say @MyAnnotation.
>
> public privileged aspect FlightTrackerAspect  {
>
> declare @type : *Flight : @MyAnnotation;
> }
> That works fine. But, let's say I have another aspect that adds a field
> through ITD to Flight.
> public aspect PersistentAspect {
>      private int Flight.persistenceDate;
> }
> I don't want @MyAnnotation to apply to persistenceDate introduced in
> PersistentAspect. Is there a way to do so ?
> I imagine to have
> declare @type : *Flight && within(Flight): @MyAnnotation;
> But I dont think it is possible.
> Any ideas ?
> Best regards,
> Anwar.
>
> _______________________________________________
> 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