Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsInstrumenting field class on Operation?
https://www.eclipse.org/forums/index.php/mv/msg/151758/477638/#msg_477638
field class in Operation, I added the corresponding annotation to the
field ownedOperation in Class but I can't find the field class to add the
annotation to it anywhere in Operation, what I'm trying to do is to
instrument the association between Operation and Class.
I appreciate any help, I've been trying to solve this for some time now
without getting any results. Thank you.
Hector]]>Hector M Chavez2008-07-28T19:16:13-00:00Re: Instrumenting field class on Operation?
https://www.eclipse.org/forums/index.php/mv/msg/151758/626831/#msg_626831
mean by "instrumenting a field"? And what kind of annotations are you
talking about?
In case it helps, an operation is owned by its class, which also
provides its namespace, so you can retrieve it by invoking
Operation#getClass_() or NamedElement#getNamespace() or
EObject#eContainer().
Rafael
Hector Chavez wrote:
> I've been trying to instrument the field ownedOperation in Class and the
> field class in Operation, I added the corresponding annotation to the
> field ownedOperation in Class but I can't find the field class to add
> the annotation to it anywhere in Operation, what I'm trying to do is to
> instrument the association between Operation and Class.
>
> I appreciate any help, I've been trying to solve this for some time now
> without getting any results. Thank you.
>
> Hector
>]]>Rafael Chaves2008-07-29T02:20:21-00:00Re: Instrumenting field class on Operation?
https://www.eclipse.org/forums/index.php/mv/msg/151758/477640/#msg_477640
mean by "instrumenting a field"? And what kind of annotations are you
talking about?
In case it helps, an operation is owned by its class, which also
provides its namespace, so you can retrieve it by invoking
Operation#getClass_() or NamedElement#getNamespace() or
EObject#eContainer().
Rafael
Hector Chavez wrote:
> I've been trying to instrument the field ownedOperation in Class and the
> field class in Operation, I added the corresponding annotation to the
> field ownedOperation in Class but I can't find the field class to add
> the annotation to it anywhere in Operation, what I'm trying to do is to
> instrument the association between Operation and Class.
>
> I appreciate any help, I've been trying to solve this for some time now
> without getting any results. Thank you.
>
> Hector
>]]>Rafael Chaves2008-07-29T02:20:21-00:00Re: Instrumenting field class on Operation?
https://www.eclipse.org/forums/index.php/mv/msg/151758/626833/#msg_626833
For example in ClassImpl over the field ownedOperation I'm adding the
annotation @Association( ... ) with information I later use for testing
purposes, so by instrumenting I just mean adding the annotation to the
field, and I also need to add the annotation @Association to the opposite
end (of the association between class and operation) in the class
OperationImpl, but there I don't see the field class or something like
that. I thought I would find something like this:
In ClassImpl a variable "ownedOperation" (which is there)
In OperationImpl a variable "class" (but there I don't find it)
I tried looking on parent classes but I didn't have luck.
Hector]]>Hector M Chavez2008-07-29T16:17:39-00:00Re: Instrumenting field class on Operation?
https://www.eclipse.org/forums/index.php/mv/msg/151758/477642/#msg_477642
For example in ClassImpl over the field ownedOperation I'm adding the
annotation @Association( ... ) with information I later use for testing
purposes, so by instrumenting I just mean adding the annotation to the
field, and I also need to add the annotation @Association to the opposite
end (of the association between class and operation) in the class
OperationImpl, but there I don't see the field class or something like
that. I thought I would find something like this:
In ClassImpl a variable "ownedOperation" (which is there)
In OperationImpl a variable "class" (but there I don't find it)
I tried looking on parent classes but I didn't have luck.
Hector]]>Hector M Chavez2008-07-29T16:17:39-00:00Re: Instrumenting field class on Operation?
https://www.eclipse.org/forums/index.php/mv/msg/151758/626834/#msg_626834
generated a new metamodel implementation based on UML2's Ecore model.
Trying to answer your question, it seems the field representing the
class of a UML operation would be EObjectImpl#eContainer in EMF itself,
i.e. is off-limits. Not only that, but the eContainer reference holds
the opposite to many different associations so I don't think that even
if you could access it, it would be a good idea.
The in-memory representation of an EMF based model is not as trivial as
a network of objects that refer to each other using plain fields.
References are often part of multiple associations. There is also
caching, lazy-loading, derived lists, etc. I don't really know what you
are trying to achieve, so this suggestion might be useless, but any
information you need about a UML model and/or the UML metamodel can be
easily obtained from the model/metamodel itself by using the UML2 and/or
EMF API, no need to mess with the generated code.
Sorry if I could not actually help much. I guess it could help if could
tell us what you are trying to achieve, and why do you think annotating
the generated code is the best way.
Cheers,
Rafael
Hector Chavez wrote:
> Rafael, thanks for your reply,
> For example in ClassImpl over the field ownedOperation I'm adding the
> annotation @Association( ... ) with information I later use for testing
> purposes, so by instrumenting I just mean adding the annotation to the
> field, and I also need to add the annotation @Association to the
> opposite end (of the association between class and operation) in the
> class OperationImpl, but there I don't see the field class or something
> like that. I thought I would find something like this:
>
> In ClassImpl a variable "ownedOperation" (which is there)
> In OperationImpl a variable "class" (but there I don't find it)
> I tried looking on parent classes but I didn't have luck.
> Hector
>
>
>]]>Rafael Chaves2008-07-30T04:06:13-00:00Re: Instrumenting field class on Operation?
https://www.eclipse.org/forums/index.php/mv/msg/151758/477643/#msg_477643
generated a new metamodel implementation based on UML2's Ecore model.
Trying to answer your question, it seems the field representing the
class of a UML operation would be EObjectImpl#eContainer in EMF itself,
i.e. is off-limits. Not only that, but the eContainer reference holds
the opposite to many different associations so I don't think that even
if you could access it, it would be a good idea.
The in-memory representation of an EMF based model is not as trivial as
a network of objects that refer to each other using plain fields.
References are often part of multiple associations. There is also
caching, lazy-loading, derived lists, etc. I don't really know what you
are trying to achieve, so this suggestion might be useless, but any
information you need about a UML model and/or the UML metamodel can be
easily obtained from the model/metamodel itself by using the UML2 and/or
EMF API, no need to mess with the generated code.
Sorry if I could not actually help much. I guess it could help if could
tell us what you are trying to achieve, and why do you think annotating
the generated code is the best way.
Cheers,
Rafael
Hector Chavez wrote:
> Rafael, thanks for your reply,
> For example in ClassImpl over the field ownedOperation I'm adding the
> annotation @Association( ... ) with information I later use for testing
> purposes, so by instrumenting I just mean adding the annotation to the
> field, and I also need to add the annotation @Association to the
> opposite end (of the association between class and operation) in the
> class OperationImpl, but there I don't see the field class or something
> like that. I thought I would find something like this:
>
> In ClassImpl a variable "ownedOperation" (which is there)
> In OperationImpl a variable "class" (but there I don't find it)
> I tried looking on parent classes but I didn't have luck.
> Hector
>
>
>]]>Rafael Chaves2008-07-30T04:06:13-00:00Re: Instrumenting field class on Operation?
https://www.eclipse.org/forums/index.php/mv/msg/151758/626835/#msg_626835
having a look at the interface (or javadoc) will provide clues. In this
case, have a look at org.eclipse.uml2.uml.Class.
The javadoc looks like the following:
/**
* Returns the value of the '<em><b>Owned Operation</b></em>' containment
reference list.
* The list contents are of type {@link org.eclipse.uml2.uml.Operation}.
* It is bidirectional and its opposite is '{@link
org.eclipse.uml2.uml.Operation#getClass_ <em>Class</em>}'.
So the the opposite is * It is bidirectional and its opposite is '{@link
org.eclipse.uml2.uml.Operation#getClass_ <em>Class</em>}'.
If you are poking around at the EMF level and want to discover the opposite
end programatically, you can use EReference.getEOpposite().
HTH,
- James.
"Rafael Chaves" <rafael@abstratt.com> wrote in message
news:g6opbh$j0q$1@build.eclipse.org...
> Hector, so it seems you are you hacking the UML2 code base itself or you
> generated a new metamodel implementation based on UML2's Ecore model.
> Trying to answer your question, it seems the field representing the class
> of a UML operation would be EObjectImpl#eContainer in EMF itself, i.e. is
> off-limits. Not only that, but the eContainer reference holds the opposite
> to many different associations so I don't think that even if you could
> access it, it would be a good idea.
>
> The in-memory representation of an EMF based model is not as trivial as a
> network of objects that refer to each other using plain fields. References
> are often part of multiple associations. There is also caching,
> lazy-loading, derived lists, etc. I don't really know what you are trying
> to achieve, so this suggestion might be useless, but any information you
> need about a UML model and/or the UML metamodel can be easily obtained
> from the model/metamodel itself by using the UML2 and/or EMF API, no need
> to mess with the generated code.
>
> Sorry if I could not actually help much. I guess it could help if could
> tell us what you are trying to achieve, and why do you think annotating
> the generated code is the best way.
>
> Cheers,
>
> Rafael
>
> Hector Chavez wrote:
>> Rafael, thanks for your reply,
>> For example in ClassImpl over the field ownedOperation I'm adding the
>> annotation @Association( ... ) with information I later use for testing
>> purposes, so by instrumenting I just mean adding the annotation to the
>> field, and I also need to add the annotation @Association to the opposite
>> end (of the association between class and operation) in the class
>> OperationImpl, but there I don't see the field class or something like
>> that. I thought I would find something like this:
>>
>> In ClassImpl a variable "ownedOperation" (which is there)
>> In OperationImpl a variable "class" (but there I don't find it)
>> I tried looking on parent classes but I didn't have luck.
>> Hector
>>
>>]]>james bruck2008-07-30T15:44:01-00:00Re: Instrumenting field class on Operation?
https://www.eclipse.org/forums/index.php/mv/msg/151758/477644/#msg_477644
having a look at the interface (or javadoc) will provide clues. In this
case, have a look at org.eclipse.uml2.uml.Class.
The javadoc looks like the following:
/**
* Returns the value of the '<em><b>Owned Operation</b></em>' containment
reference list.
* The list contents are of type {@link org.eclipse.uml2.uml.Operation}.
* It is bidirectional and its opposite is '{@link
org.eclipse.uml2.uml.Operation#getClass_ <em>Class</em>}'.
So the the opposite is * It is bidirectional and its opposite is '{@link
org.eclipse.uml2.uml.Operation#getClass_ <em>Class</em>}'.
If you are poking around at the EMF level and want to discover the opposite
end programatically, you can use EReference.getEOpposite().
HTH,
- James.
"Rafael Chaves" <rafael@abstratt.com> wrote in message
news:g6opbh$j0q$1@build.eclipse.org...
> Hector, so it seems you are you hacking the UML2 code base itself or you
> generated a new metamodel implementation based on UML2's Ecore model.
> Trying to answer your question, it seems the field representing the class
> of a UML operation would be EObjectImpl#eContainer in EMF itself, i.e. is
> off-limits. Not only that, but the eContainer reference holds the opposite
> to many different associations so I don't think that even if you could
> access it, it would be a good idea.
>
> The in-memory representation of an EMF based model is not as trivial as a
> network of objects that refer to each other using plain fields. References
> are often part of multiple associations. There is also caching,
> lazy-loading, derived lists, etc. I don't really know what you are trying
> to achieve, so this suggestion might be useless, but any information you
> need about a UML model and/or the UML metamodel can be easily obtained
> from the model/metamodel itself by using the UML2 and/or EMF API, no need
> to mess with the generated code.
>
> Sorry if I could not actually help much. I guess it could help if could
> tell us what you are trying to achieve, and why do you think annotating
> the generated code is the best way.
>
> Cheers,
>
> Rafael
>
> Hector Chavez wrote:
>> Rafael, thanks for your reply,
>> For example in ClassImpl over the field ownedOperation I'm adding the
>> annotation @Association( ... ) with information I later use for testing
>> purposes, so by instrumenting I just mean adding the annotation to the
>> field, and I also need to add the annotation @Association to the opposite
>> end (of the association between class and operation) in the class
>> OperationImpl, but there I don't see the field class or something like
>> that. I thought I would find something like this:
>>
>> In ClassImpl a variable "ownedOperation" (which is there)
>> In OperationImpl a variable "class" (but there I don't find it)
>> I tried looking on parent classes but I didn't have luck.
>> Hector
>>
>>]]>james bruck2008-07-30T15:44:01-00:00Re: Instrumenting field class on Operation?
https://www.eclipse.org/forums/index.php/mv/msg/151758/626838/#msg_626838
learn a little bit more about EMF and then decide if the approach I'm
trying is feasible, I'm actually not trying to modify the code, just
adding info to latter with the help of ASM instrument the code to keep
track of fields read and other info while the destroy methods are
executed, I did it with other classes (not uml) that implement ownership
but the structure was not as complex. Thanks for your prompt responses.
Hector]]>Hector M Chavez2008-07-30T22:20:44-00:00Re: Instrumenting field class on Operation?
https://www.eclipse.org/forums/index.php/mv/msg/151758/477647/#msg_477647
learn a little bit more about EMF and then decide if the approach I'm
trying is feasible, I'm actually not trying to modify the code, just
adding info to latter with the help of ASM instrument the code to keep
track of fields read and other info while the destroy methods are
executed, I did it with other classes (not uml) that implement ownership
but the structure was not as complex. Thanks for your prompt responses.