Home » Modeling » UML2 » InstanceSpecification of a Modeled Class
| InstanceSpecification of a Modeled Class [message #537829] |
Thu, 03 June 2010 15:10  |
Hector Chavez Messages: 34 Registered: February 2010 |
Member |
|
|
Hello,
I have been playing with the ExtendedPO2, the example given in "Getting Started with UML2" and I'm trying to create an instance of one of the modeled classes using InstanceSpecification.
What I'm doing is: I create an instance specification, then I create a slot for the property "name", and then to assign a value I'm using the setValue() method, but it requires a StereoType.
Do I have to create a stereotype for the class? or maybe this is not the right approach.
InstanceSpecification is = UMLFactory.eINSTANCE.createInstanceSpecification();
is.setName("supplierInstance");
is.getClassifiers().add(supplierClass);
Slot sn = is.createSlot();
Property name = supplierClass.getAttribute("name", stringPrimitiveType);
sn.setDefiningFeature(name);
//sn.setValue(StereoType, ..., ...)????
Thank you.
Hector
|
|
| | | |
| Re: InstanceSpecification of a Modeled Class [message #538005 is a reply to message #537829] |
Fri, 04 June 2010 09:25   |
Christian W. Damus Messages: 550 Registered: July 2009 |
Senior Member |
|
|
Hi, Hector,
Slots have multiple values. Get the value collection:
EList<ValueSpecification> Slot::getValues()
and add some kind of a ValueSpecification to it.
The setValue(Stereotype, ...) method is the API on the Element type that
sets stereotype attribute values. That has nothing to do with your
requirement.
Cheers,
Christian
On 03/06/10 03:10 PM, Hector Chavez wrote:
> Hello,
>
> I have been playing with the ExtendedPO2, the example given in "Getting
> Started with UML2" and I'm trying to create an instance of one of the
> modeled classes using InstanceSpecification.
>
> What I'm doing is: I create an instance specification, then I create a
> slot for the property "name", and then to assign a value I'm using the
> setValue() method, but it requires a StereoType.
> Do I have to create a stereotype for the class? or maybe this is not the
> right approach.
>
>
> InstanceSpecification is =
> UMLFactory.eINSTANCE.createInstanceSpecification();
> is.setName("supplierInstance");
> is.getClassifiers().add(supplierClass);
> Slot sn = is.createSlot();
> Property name = supplierClass.getAttribute("name", stringPrimitiveType);
> sn.setDefiningFeature(name);
> //sn.setValue(StereoType, ..., ...)????
>
> Thank you.
>
> Hector
|
|
| |
| Re: InstanceSpecification of a Modeled Class [message #538082 is a reply to message #538005] |
Fri, 04 June 2010 17:05   |
Hector Chavez Messages: 34 Registered: February 2010 |
Member |
|
|
Thank you Christian, it is working now. I was looking at the wrong method.
Hector
| Christian W. Damus wrote on Fri, 04 June 2010 09:25 | Hi, Hector,
Slots have multiple values. Get the value collection:
EList<ValueSpecification> Slot::getValues()
and add some kind of a ValueSpecification to it.
The setValue(Stereotype, ...) method is the API on the Element type that
sets stereotype attribute values. That has nothing to do with your
requirement.
Cheers,
Christian
On 03/06/10 03:10 PM, Hector Chavez wrote:
> Hello,
>
> I have been playing with the ExtendedPO2, the example given in "Getting
> Started with UML2" and I'm trying to create an instance of one of the
> modeled classes using InstanceSpecification.
>
> What I'm doing is: I create an instance specification, then I create a
> slot for the property "name", and then to assign a value I'm using the
> setValue() method, but it requires a StereoType.
> Do I have to create a stereotype for the class? or maybe this is not the
> right approach.
>
>
> InstanceSpecification is =
> UMLFactory.eINSTANCE.createInstanceSpecification();
> is.setName("supplierInstance");
> is.getClassifiers().add(supplierClass);
> Slot sn = is.createSlot();
> Property name = supplierClass.getAttribute("name", stringPrimitiveType);
> sn.setDefiningFeature(name);
> //sn.setValue(StereoType, ..., ...)????
>
> Thank you.
>
> Hector
|
|
|
| | | |
| Re: InstanceSpecification of a Modeled Class [message #628493 is a reply to message #537829] |
Fri, 04 June 2010 09:25   |
Christian W. Damus Messages: 550 Registered: July 2009 |
Senior Member |
|
|
Hi, Hector,
Slots have multiple values. Get the value collection:
EList<ValueSpecification> Slot::getValues()
and add some kind of a ValueSpecification to it.
The setValue(Stereotype, ...) method is the API on the Element type that
sets stereotype attribute values. That has nothing to do with your
requirement.
Cheers,
Christian
On 03/06/10 03:10 PM, Hector Chavez wrote:
> Hello,
>
> I have been playing with the ExtendedPO2, the example given in "Getting
> Started with UML2" and I'm trying to create an instance of one of the
> modeled classes using InstanceSpecification.
>
> What I'm doing is: I create an instance specification, then I create a
> slot for the property "name", and then to assign a value I'm using the
> setValue() method, but it requires a StereoType.
> Do I have to create a stereotype for the class? or maybe this is not the
> right approach.
>
>
> InstanceSpecification is =
> UMLFactory.eINSTANCE.createInstanceSpecification();
> is.setName("supplierInstance");
> is.getClassifiers().add(supplierClass);
> Slot sn = is.createSlot();
> Property name = supplierClass.getAttribute("name", stringPrimitiveType);
> sn.setDefiningFeature(name);
> //sn.setValue(StereoType, ..., ...)????
>
> Thank you.
>
> Hector
|
|
| |
| Re: InstanceSpecification of a Modeled Class [message #628496 is a reply to message #538005] |
Fri, 04 June 2010 17:05  |
Hector Chavez Messages: 34 Registered: February 2010 |
Member |
|
|
Thank you Christian, it is working now. I was looking at the wrong method.
Hector
Christian W. Damus wrote on Fri, 04 June 2010 09:25
> Hi, Hector,
>
> Slots have multiple values. Get the value collection:
>
> EList<ValueSpecification> Slot::getValues()
>
> and add some kind of a ValueSpecification to it.
>
> The setValue(Stereotype, ...) method is the API on the Element type that
> sets stereotype attribute values. That has nothing to do with your
> requirement.
>
> Cheers,
>
> Christian
>
>
> On 03/06/10 03:10 PM, Hector Chavez wrote:
> > Hello,
> >
> > I have been playing with the ExtendedPO2, the example given in "Getting
> > Started with UML2" and I'm trying to create an instance of one of the
> > modeled classes using InstanceSpecification.
> >
> > What I'm doing is: I create an instance specification, then I create a
> > slot for the property "name", and then to assign a value I'm using the
> > setValue() method, but it requires a StereoType.
> > Do I have to create a stereotype for the class? or maybe this is not the
> > right approach.
> >
> >
> > InstanceSpecification is =
> > UMLFactory.eINSTANCE.createInstanceSpecification();
> > is.setName("supplierInstance");
> > is.getClassifiers().add(supplierClass);
> > Slot sn = is.createSlot();
> > Property name = supplierClass.getAttribute("name", stringPrimitiveType);
> > sn.setDefiningFeature(name);
> > //sn.setValue(StereoType, ..., ...)????
> >
> > Thank you.
> >
> > Hector
|
|
|
Goto Forum:
Current Time: Mon May 20 21:40:17 EDT 2013
Powered by FUDForum. Page generated in 0.01948 seconds
|