Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » declaring and using a template class
declaring and using a template class [message #603188] Mon, 26 March 2007 22:13
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020607060809090501020808
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I am having a hard time building a UML model that uses template elements.

For instance, how should I ago about modeling in UML a class equivalent
to this Java code:

class List<T> {
public void add(T o) {...}
public T get(int pos) {...}
}

and then bind that template with class Account, generating a type that
is a list of accounts?

I believe this can be done in EMF, but can it be done if modeling is
done in UML2? How?

I am still going through the specs for Templates (section 17.5), but so
far it is not clear if I can do it in UML2. I have built the model
attached, created a genmodel from it, but the resulting ECore model
treats the template parameter class as a regular class. Can anyone see
what I am doing wrong/missing?

Thanks,

Rafael

--------------020607060809090501020808
Content-Type: text/xml;
name="My.uml"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="My.uml"

<?xml version="1.0" encoding="UTF-8"?>
<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML" xmi:id="_SbY9YNvCEdunJ--GsIRueA" name="My">
<packagedElement xmi:type="uml:Class" xmi:id="_bG2RoNvCEdunJ--GsIRueA" name="List">
<ownedTemplateSignature xmi:type="uml:RedefinableTemplateSignature" xmi:id="_Td5xANvHEdunJ--GsIRueA" name="List Signature" parameter="_VfIB4NvHEdunJ--GsIRueA">
<ownedParameter xmi:type="uml:ClassifierTemplateParameter" xmi:id="_VfIB4NvHEdunJ--GsIRueA" parameteredElement="_PqhDUNvlEduCr7xIhpvxLA" allowSubstitutable="false">
<ownedParameteredElement xmi:type="uml:Class" xmi:id="_PqhDUNvlEduCr7xIhpvxLA" name="P" templateParameter="_VfIB4NvHEdunJ--GsIRueA"/>
</ownedParameter>
</ownedTemplateSignature>
<ownedOperation xmi:id="_B8SSYNvdEdunJ--GsIRueA" name="op1">
<ownedParameter xmi:id="_iO2okNviEdunJ--GsIRueA" name="p" type="_PqhDUNvlEduCr7xIhpvxLA"/>
</ownedOperation>
</packagedElement>
<packagedElement xmi:type="uml:Class" xmi:id="_qayvQNviEdunJ--GsIRueA" name="ListOfAccounts">
<templateBinding xmi:id="_uS63YNviEdunJ--GsIRueA">
<parameterSubstitution xmi:id="_waJpoNviEdunJ--GsIRueA" formal="_VfIB4NvHEdunJ--GsIRueA" actual="_0vf5QNviEdunJ--GsIRueA"/>
</templateBinding>
</packagedElement>
<packagedElement xmi:type="uml:Class" xmi:id="_0vf5QNviEdunJ--GsIRueA" name="Account"/>
</uml:Model>

--------------020607060809090501020808--
Previous Topic:Load xmi file of UML2 Model
Next Topic:Installing uml2...
Goto Forum:
  


Current Time: Fri Apr 19 23:54:49 GMT 2024

Powered by FUDForum. Page generated in 0.02662 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top