Re: [mdr-users] continueing . . How to create Associations and AssociationEnd?

Richard Ciglansky <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.mdr.user
Message-ID <[email protected]>
>> To associate an attribute with a mof class, just add the attribute to 
>> the contents of that class:
>>
>> mofClass.getContents().add(attribute)
>>             This solution is fine if an attribute is of type 
>> primitive or any
>> Java class. But if it is another MofClass(which means user defined
>> class or interface), Don't I need to create some kind of
>> reference/association between the two classes ?
>>  
>>
> I do not understand what you mean. A MOF attribute can be of MOF type 
> only. Regardless of the attribute type, the attributes are added to a 
> class the same way I described.

I think that how Leena is using MDR/JMI/MOF is not exactly the way these 
technologies are intended to be used.
When you want to parser Java code and put it "into MDR", the best way 
would be to write some Java - MOF compliant metamodel ( the same thing 
like UML just for Java language ) and then create instance of this model 
modeling particular Java application. It seems that you are importing 
Java directly into MOF, creating in such a way MOF metamodel rather than 
MOF model. Please check MOF/UML/JMI specification where this 4-layer 
modeling architecture is explained ( MOF metameta model, MOF metamodel, 
MOF model, model instance ). Surely everything depends on point of view, 
but I would highly suggest to import Java as MOF model and not MOF 
metamodel.

Good news, actually you don't need to "write Java metamodel" as Netbeans 
already contains Java metamodel you can use, maybe you can use whole 
Netbeans module used for manipulating Java sources in "MDR way". Then no 
parsing, no imports, just manipulation of Java program stored in MDR/MOF 
form.

Hope this helps

Richard

>>   This also applies for creating and association between current
>> class and its super classes which again will be MofClasses. Hw do I
>> achieve this?
>>  
>>
> mofClass.getSupertypes().add(superClass)
>
> or (if there is more than one superclass:
>
> mofClass.getSupertypes().addAll(superClasses)
>
> Regards,
> Martin
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.