Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] RE: Inter-type declaration for annotated classes

Hi Ron,

I tried, but hibernate especifically does not recognize the field as a field on the class via reflection, so it doesn´t help.

But if I do this, it works, well I have to declare it public, but works.

@ javax.persistence.Id <http://javax.persistence.Id>
public String TestEntity.id;

I just wanted to be able to introduze a field to an annotated class and by reflection an user of the class could not distinguish if it was introduced by an aspect.

Juan.




Message: 1
Date: Fri, 18 May 2007 09:21:53 -0700
From: "Ron Bodkin" <rbodkin@xxxxxxxxxxxxxx>
Subject: RE: [aspectj-dev] Inter-type declaration for annotated
        classes
To: "'AspectJ developer discussions'" < aspectj-dev@xxxxxxxxxxx>
Message-ID: <464dd2cc.3bf7dcf5.17c6.36a3@xxxxxxxxxxxxx>
Content-Type: text/plain; charset="iso-8859-1"

Juan,



You need to use declare parents to make the annotated types implement a
marker interface, and then do your inter-type declaration on the interface.



  _____

From: aspectj-dev-bounces@xxxxxxxxxxx
[mailto:aspectj-dev-bounces@xxxxxxxxxxx] On Behalf Of Juan Bernabo
Sent: Thursday, May 17, 2007 7:45 PM
To: aspectj-dev@xxxxxxxxxxx
Subject: [aspectj-dev] Inter-type declaration for annotated classes



Hi,

I would like to know if is supported in AspectJ an inter-type declaration of
a field or a method for an annotated class.

I want to introduce a field, into a class annotated with @Identifiable

@Identifiable
class TestEntity
{
....
};

In the aspect I want to introduce a new field or method like:

@ javax.persistence.Id <http://javax.persistence.Id>
String TestEntity.id;

Declaring the field that way works but I don´t to want to explicit the
class, I want to introduce this field in any class with the @Identifiable
annotation, probably the declaration would be something like this:

@javax.persistence.Id
String @ Identifiable.id < http://Identifiable.id> ;

I tried putting the field in a new class and introduce it by declare
partents, that supports annotations but hibernate and other products does´t
seem to like this, as it´s not exactly part of the original class.

Is this supported, if not, will this be supported?

Thanks in advance,
Juan.

--
TeamWare do Brasil
Equipes Altamente Eficazes
Agilidade, Pessoas e Tecnologia
Tel: +55 (11) 5061-8221


Back to the top