|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Intertype declarations results in too long namesHi All,
I have an intertype declaration like this: private Integer MyClass.id; but, when it was compiled/weaved, this attribute receive the name: ajc$interField$mypack_mysubpack_MyAspect$id. I want MyClass receive an id attribute and not a ajc$...$id attribute. How to do it? Thanks! PS: Sorry for my poor English. It isn't my native language :). _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
Re: Intertype declarations results in too long namesHi,
The ajc$interField$mypack_mysubpack_MyAspect$id is internal and not expected to be directly referenced in the source code. It is only needed for the byte code (i.e., you should not be concerned with it). All you need to know is that the declaration declares an Integer field 'id' on MyClass that is private to the aspect (ie- it is not accessible anywhere outside the aspect). Unless you require knowledge about the byte code, the byte code name should not be of concern to you. However, if you do require knowledge about the byte code, please explain what that is and perhaps we can help you. --a On Mon, Nov 2, 2009 at 2:45 PM, db <dbconrado@...> wrote: > Hi All, > > I have an intertype declaration like this: > > private Integer MyClass.id; > > but, when it was compiled/weaved, this attribute receive the name: > ajc$interField$mypack_mysubpack_MyAspect$id. > I want MyClass receive an id attribute and not a ajc$...$id attribute. > How to do it? > > Thanks! > > PS: Sorry for my poor English. It isn't my native language :). > > _______________________________________________ > aspectj-users mailing list > aspectj-users@... > https://dev.eclipse.org/mailman/listinfo/aspectj-users > > aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
Re: Intertype declarations results in too long namesIf you need access to the value, make sure to introduced the getId()
method in your aspect as well: public Integer YourThingy.getId() { return id; } -matthew On Mon, Nov 2, 2009 at 2:03 PM, Andrew Eisenberg <andrew@...> wrote: > Hi, > > The ajc$interField$mypack_mysubpack_MyAspect$id is internal and not > expected to be directly referenced in the source code. It is only > needed for the byte code (i.e., you should not be concerned with it). > All you need to know is that the declaration declares an Integer field > 'id' on MyClass that is private to the aspect (ie- it is not > accessible anywhere outside the aspect). > > Unless you require knowledge about the byte code, the byte code name > should not be of concern to you. However, if you do require knowledge > about the byte code, please explain what that is and perhaps we can > help you. > > --a > > On Mon, Nov 2, 2009 at 2:45 PM, db <dbconrado@...> wrote: >> Hi All, >> >> I have an intertype declaration like this: >> >> private Integer MyClass.id; >> >> but, when it was compiled/weaved, this attribute receive the name: >> ajc$interField$mypack_mysubpack_MyAspect$id. >> I want MyClass receive an id attribute and not a ajc$...$id attribute. >> How to do it? >> >> Thanks! >> >> PS: Sorry for my poor English. It isn't my native language :). >> >> _______________________________________________ >> aspectj-users mailing list >> aspectj-users@... >> https://dev.eclipse.org/mailman/listinfo/aspectj-users >> >> > _______________________________________________ > aspectj-users mailing list > aspectj-users@... > https://dev.eclipse.org/mailman/listinfo/aspectj-users > -- mailto:matthew@... skype:matthewadams12 yahoo:matthewadams aol:matthewadams12 google-talk:matthewadams12@... msn:matthew@... http://matthewadams.me http://www.linkedin.com/in/matthewadams _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
Re: Intertype declarations results in too long namesThe name for a public intertype declaration is not mangled - can you
use public in your case? Andy 2009/11/2 Andrew Eisenberg <andrew@...>: > Hi, > > The ajc$interField$mypack_mysubpack_MyAspect$id is internal and not > expected to be directly referenced in the source code. It is only > needed for the byte code (i.e., you should not be concerned with it). > All you need to know is that the declaration declares an Integer field > 'id' on MyClass that is private to the aspect (ie- it is not > accessible anywhere outside the aspect). > > Unless you require knowledge about the byte code, the byte code name > should not be of concern to you. However, if you do require knowledge > about the byte code, please explain what that is and perhaps we can > help you. > > --a > > On Mon, Nov 2, 2009 at 2:45 PM, db <dbconrado@...> wrote: >> Hi All, >> >> I have an intertype declaration like this: >> >> private Integer MyClass.id; >> >> but, when it was compiled/weaved, this attribute receive the name: >> ajc$interField$mypack_mysubpack_MyAspect$id. >> I want MyClass receive an id attribute and not a ajc$...$id attribute. >> How to do it? >> >> Thanks! >> >> PS: Sorry for my poor English. It isn't my native language :). >> >> _______________________________________________ >> aspectj-users mailing list >> aspectj-users@... >> https://dev.eclipse.org/mailman/listinfo/aspectj-users >> >> > _______________________________________________ > aspectj-users mailing list > aspectj-users@... > https://dev.eclipse.org/mailman/listinfo/aspectj-users > aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
Re: Intertype declarations results in too long namesJust thought I'd throw in here with a case where I've ran into
problems with this... JPA. If you have common fields you want to inject into an entity you might try to do something like private String CommonInterface.commonField And expect at runtime that will result in a db column named common_field, or whatever else your naming strategy comes up with. Sure you could use the @Column annotation and explicitly give it a name, but that adds in a declare statement and it is definitely a bit confusing when you first run across the issue. JPA is not the only framework to do this type of reflection these days, Seam's @In injection is another one that tries to determine a value based on the name of the field. Of course i imagine this was done to avoid naming collisions when you receive fields from multiple ITDs and I'm not sure I see a better solution. On Nov 2, 2009, at 5:03 PM, Andrew Eisenberg wrote: > Hi, > > The ajc$interField$mypack_mysubpack_MyAspect$id is internal and not > expected to be directly referenced in the source code. It is only > needed for the byte code (i.e., you should not be concerned with it). > All you need to know is that the declaration declares an Integer field > 'id' on MyClass that is private to the aspect (ie- it is not > accessible anywhere outside the aspect). > > Unless you require knowledge about the byte code, the byte code name > should not be of concern to you. However, if you do require knowledge > about the byte code, please explain what that is and perhaps we can > help you. > > --a > > On Mon, Nov 2, 2009 at 2:45 PM, db <dbconrado@...> wrote: >> Hi All, >> >> I have an intertype declaration like this: >> >> private Integer MyClass.id; >> >> but, when it was compiled/weaved, this attribute receive the name: >> ajc$interField$mypack_mysubpack_MyAspect$id. >> I want MyClass receive an id attribute and not a ajc$...$id >> attribute. >> How to do it? >> >> Thanks! >> >> PS: Sorry for my poor English. It isn't my native language :). >> >> _______________________________________________ >> aspectj-users mailing list >> aspectj-users@... >> https://dev.eclipse.org/mailman/listinfo/aspectj-users >> >> > _______________________________________________ > aspectj-users mailing list > aspectj-users@... > https://dev.eclipse.org/mailman/listinfo/aspectj-users _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
Re: Intertype declarations results in too long names> but that adds in a declare statement
Just to say, if you annotate the ITD, that will be on the introduced target method - you don't need an additional 'declare @method'. >From a Roo project: @javax.persistence.Id @javax.persistence.GeneratedValue(strategy=javax.persistence.GenerationType.AUTO) @javax.persistence.Column(name="id") private java.lang.Long Pet.id; cheers, Andy 2009/11/2 Dave Whittaker <dave@...>: > Just thought I'd throw in here with a case where I've ran into problems with > this... JPA. If you have common fields you want to inject into an entity > you might try to do something like > > private String CommonInterface.commonField > > And expect at runtime that will result in a db column named common_field, or > whatever else your naming strategy comes up with. Sure you could use the > @Column annotation and explicitly give it a name, but that adds in a declare > statement and it is definitely a bit confusing when you first run across the > issue. JPA is not the only framework to do this type of reflection these > days, Seam's @In injection is another one that tries to determine a value > based on the name of the field. > > Of course i imagine this was done to avoid naming collisions when you > receive fields from multiple ITDs and I'm not sure I see a better solution. > > On Nov 2, 2009, at 5:03 PM, Andrew Eisenberg wrote: > >> Hi, >> >> The ajc$interField$mypack_mysubpack_MyAspect$id is internal and not >> expected to be directly referenced in the source code. It is only >> needed for the byte code (i.e., you should not be concerned with it). >> All you need to know is that the declaration declares an Integer field >> 'id' on MyClass that is private to the aspect (ie- it is not >> accessible anywhere outside the aspect). >> >> Unless you require knowledge about the byte code, the byte code name >> should not be of concern to you. However, if you do require knowledge >> about the byte code, please explain what that is and perhaps we can >> help you. >> >> --a >> >> On Mon, Nov 2, 2009 at 2:45 PM, db <dbconrado@...> wrote: >>> >>> Hi All, >>> >>> I have an intertype declaration like this: >>> >>> private Integer MyClass.id; >>> >>> but, when it was compiled/weaved, this attribute receive the name: >>> ajc$interField$mypack_mysubpack_MyAspect$id. >>> I want MyClass receive an id attribute and not a ajc$...$id attribute. >>> How to do it? >>> >>> Thanks! >>> >>> PS: Sorry for my poor English. It isn't my native language :). >>> >>> _______________________________________________ >>> aspectj-users mailing list >>> aspectj-users@... >>> https://dev.eclipse.org/mailman/listinfo/aspectj-users >>> >>> >> _______________________________________________ >> aspectj-users mailing list >> aspectj-users@... >> https://dev.eclipse.org/mailman/listinfo/aspectj-users > > _______________________________________________ > aspectj-users mailing list > aspectj-users@... > https://dev.eclipse.org/mailman/listinfo/aspectj-users > aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
Re: Intertype declarations results in too long namesHi all,
Thanks! I want to declare an id attribute in a persistent class (to be used by JPA). But the generated attribute has a long name and mysql doesn't accept it. I completely forgot the @Column annotation! :) I can use @Column(name="id") to solve the problem. Thanks again! :) --db On Mon, Nov 2, 2009 at 8:53 PM, Andy Clement <andrew.clement@...> wrote:
_______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
Re: Intertype declarations results in too long namesHuh, I would have sworn I had tried that in the past and it hadn't
worked. Thanks for the tip. On Nov 2, 2009, at 5:53 PM, Andy Clement wrote: >> but that adds in a declare statement > > Just to say, if you annotate the ITD, that will be on the introduced > target method - you don't need an additional 'declare @method'. > >> From a Roo project: > @javax.persistence.Id > > @javax > .persistence > .GeneratedValue(strategy=javax.persistence.GenerationType.AUTO) > @javax.persistence.Column(name="id") > private java.lang.Long Pet.id; > > cheers, > Andy > > 2009/11/2 Dave Whittaker <dave@...>: >> Just thought I'd throw in here with a case where I've ran into >> problems with >> this... JPA. If you have common fields you want to inject into an >> entity >> you might try to do something like >> >> private String CommonInterface.commonField >> >> And expect at runtime that will result in a db column named >> common_field, or >> whatever else your naming strategy comes up with. Sure you could >> use the >> @Column annotation and explicitly give it a name, but that adds in >> a declare >> statement and it is definitely a bit confusing when you first run >> across the >> issue. JPA is not the only framework to do this type of reflection >> these >> days, Seam's @In injection is another one that tries to determine a >> value >> based on the name of the field. >> >> Of course i imagine this was done to avoid naming collisions when you >> receive fields from multiple ITDs and I'm not sure I see a better >> solution. >> >> On Nov 2, 2009, at 5:03 PM, Andrew Eisenberg wrote: >> >>> Hi, >>> >>> The ajc$interField$mypack_mysubpack_MyAspect$id is internal and not >>> expected to be directly referenced in the source code. It is only >>> needed for the byte code (i.e., you should not be concerned with >>> it). >>> All you need to know is that the declaration declares an Integer >>> field >>> 'id' on MyClass that is private to the aspect (ie- it is not >>> accessible anywhere outside the aspect). >>> >>> Unless you require knowledge about the byte code, the byte code name >>> should not be of concern to you. However, if you do require >>> knowledge >>> about the byte code, please explain what that is and perhaps we can >>> help you. >>> >>> --a >>> >>> On Mon, Nov 2, 2009 at 2:45 PM, db <dbconrado@...> wrote: >>>> >>>> Hi All, >>>> >>>> I have an intertype declaration like this: >>>> >>>> private Integer MyClass.id; >>>> >>>> but, when it was compiled/weaved, this attribute receive the name: >>>> ajc$interField$mypack_mysubpack_MyAspect$id. >>>> I want MyClass receive an id attribute and not a ajc$...$id >>>> attribute. >>>> How to do it? >>>> >>>> Thanks! >>>> >>>> PS: Sorry for my poor English. It isn't my native language :). >>>> >>>> _______________________________________________ >>>> aspectj-users mailing list >>>> aspectj-users@... >>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users >>>> >>>> >>> _______________________________________________ >>> aspectj-users mailing list >>> aspectj-users@... >>> https://dev.eclipse.org/mailman/listinfo/aspectj-users >> >> _______________________________________________ >> aspectj-users mailing list >> aspectj-users@... >> https://dev.eclipse.org/mailman/listinfo/aspectj-users >> > _______________________________________________ > aspectj-users mailing list > aspectj-users@... > https://dev.eclipse.org/mailman/listinfo/aspectj-users _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
| Free embeddable forum powered by Nabble | Forum Help |