Home » Modeling » UML2 » Instrumenting field class on Operation?
| | |
Re: Instrumenting field class on Operation? [message #477643 is a reply to message #477642] |
Wed, 30 July 2008 04:06 |
Rafael Chaves Messages: 362 Registered: July 2009 |
Senior Member |
|
|
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
>
>
>
|
|
|
Re: Instrumenting field class on Operation? [message #477644 is a reply to message #477643] |
Wed, 30 July 2008 15:44 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
If one is trying to determine the opposite end of an association, then
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>}'.
* <p>
* This feature subsets the following features:
* <ul>
* <li>'{@link org.eclipse.uml2.uml.Classifier#getFeatures()
<em>Feature</em>}'</li>
* <li>'{@link org.eclipse.uml2.uml.Namespace#getOwnedMembers() <em>Owned
Member</em>}'</li>
* </ul>
* </p>
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* The operations owned by the class.
* <!-- end-model-doc -->
* @return the value of the '<em>Owned Operation</em>' containment reference
list.
* @see org.eclipse.uml2.uml.UMLPackage#getClass_OwnedOperation()
* @see org.eclipse.uml2.uml.Operation#getClass_
* @model opposite="class" containment="true" resolveProxies="true"
* @generated
*/
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
>>
>>
|
|
| | | |
Re: Instrumenting field class on Operation? [message #626834 is a reply to message #477642] |
Wed, 30 July 2008 04:06 |
Rafael Chaves Messages: 362 Registered: July 2009 |
Senior Member |
|
|
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
>
>
>
|
|
|
Re: Instrumenting field class on Operation? [message #626835 is a reply to message #477643] |
Wed, 30 July 2008 15:44 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
If one is trying to determine the opposite end of an association, then
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>}'.
* <p>
* This feature subsets the following features:
* <ul>
* <li>'{@link org.eclipse.uml2.uml.Classifier#getFeatures()
<em>Feature</em>}'</li>
* <li>'{@link org.eclipse.uml2.uml.Namespace#getOwnedMembers() <em>Owned
Member</em>}'</li>
* </ul>
* </p>
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* The operations owned by the class.
* <!-- end-model-doc -->
* @return the value of the '<em>Owned Operation</em>' containment reference
list.
* @see org.eclipse.uml2.uml.UMLPackage#getClass_OwnedOperation()
* @see org.eclipse.uml2.uml.Operation#getClass_
* @model opposite="class" containment="true" resolveProxies="true"
* @generated
*/
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
>>
>>
|
|
| |
Goto Forum:
Current Time: Fri Sep 20 12:01:46 GMT 2024
Powered by FUDForum. Page generated in 0.05080 seconds
|