Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] A way to change annotation declaration by aspect or adding an attribute.

Hi,

At the moment you can't partially replace an annotation (by modifying
some of the annotation values), but you could remove an annotation and
add a different one its place, feasibly, if using the annotation
removal construct:

declare @field : * *uuid: -@Column;
declare @field : * *uuid : @Column(columnDefinition="uuid NOT NULL");

But your nullable value will be lost.  This bugzilla
https://bugs.eclipse.org/bugs/show_bug.cgi?id=313026 is covering some
of the potential enhancements here
(augmentation/replacement/precedence for declare annotation).

> Are there a way to use dynamic construction with declare @field
I'm afraid not.  This could be feasible for fixed elements at a
joinpoint that are known at compile/weave time (so those encapsulated
in thisJoinPointStaticPart), but not for the more dynamic features in
thisJoinPoint which aren't known until runtime.  Feel free to raise an
enhancement request for this.

cheers,
Andy

On 13 August 2012 02:53, Jean-Jacques Peyronel
<jjpeyronel@xxxxxxxxxxxxxx> wrote:
> Hi all,
>
> I have this :
>
> @Column(name="account_category_uuid", nullable=false)
> @Id
> private java.util.UUID account_category_uuid;
>
> I want an aspect who change :
> @Column(name="account_category_uuid", nullable=false)
> to
> @Column(name="account_category_uuid", nullable=false,
> columnDefinition="uuid NOT NULL")
>
> I've a lot of class with this sort of declaration.
>
> I've tried :
> declare @field : * *uuid : @Column(columnDefinition="uuid NOT NULL");
> but this seems not change the first declaration.
>
> Are there a way to use dynamic construction with declare @field like :
> @Column(name=thisjointpoint+"_uuid", nullable=false,
> columnDefinition="uuid NOT NULL")
>
> Thanks in advance.
>
> Jean-Jacques.
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top