|
Re: How to retrieve the DefaultValues of stereotype? [message #1021706 is a reply to message #1021673] |
Wed, 20 March 2013 14:42 |
|
Hi, Mariem,
I don't understand what you mean by "retriev[ing] the Defaults Values".
You can't set the default values for the attributes of MARTE
stereotypes: the MARTE profiles are read-only.
You can set default values of attributes of classifiers in your model
that may have MARTE stereotypes applied, but those stereotypes are
immaterial.
Or, do you mean that you have set the values of these stereotype
attributes on some element in your model?
Do you need to access these values in an OCL constraint? A model
transformation? In Java code?
Cheers,
Christian
On 2013-03-20 13:47:06 +0000, Mariem Makni said:
> Hi,
>
> I'm modeling a real time operating system (RTOS) using Papyrus and
> using the Profile in Software Resource Modeling (SRM) of Standard MARTE.
> I have an Element Class applied by the stereotype
> "SwSchedulableResource", this stereotype has attributes like
> (priorityElemnts, periodElements,...), I have assigned defaults values
> for some attributes of the "SwSchedulableResource" as show below:
>
> priorityElements=[priorityValue, maxpriorityLevel, minPriorityLevel]
> periodElements=[period]
>
> I want to know how to retrieve the defaults values of the attribut
> priorityElements and periodElements.
>
> I used Stereotype st=myclass.getAppliedStereotypes().getAllAttributes();
>
> But I don't know how to retrieve the Defaults Values.
>
> Can you help me please.
> Thanks in advance.
|
|
|
|
Re: How to retrieve the DefaultValues of stereotype? [message #1021741 is a reply to message #1021720] |
Wed, 20 March 2013 15:55 |
|
Hi, Mariem,
You didn't answer whether you need to access the default value of a
property or the value of a stereotype attribute.
The org.eclipse.uml2.uml.Property::getDefaultValue() method returns the
property's default value. This works for attributes of classes in you
model as well as for attributes of stereotypes in the MARTE profile.
In the latter case, you would have to get the Stereotype object from
the appropriate profile and get from it the Property (an
ownedAttribute) that you are interested in.
If you need to get the value of an attribute of a stereotype
application on some element in your model, use the
org.eclipse.uml2.uml.Element::getValue(Stereotype, String) method.
HTH,
Christian
On 2013-03-20 15:12:41 +0000, Mariem Makni said:
> Hi,
>
> Thanks for your reply.
>
> Yes,I need to access these values in Java code.
>
> can you help me please
|
|
|
|
Re: How to retrieve the DefaultValues of stereotype? [message #1022227 is a reply to message #1022082] |
Thu, 21 March 2013 14:05 |
|
Hi, Mariem,
To say that it doesn't work is not useful. What happens that you did
not expect, or what does not happen that you expected? Is
'appliedStereotype' null? Is the 'priorityElements' null? Do you get
a ClassCastException? Do you get an IllegalArgumentException? In
either case, provide the stack trace or debug at the point where it is
thrown to determine why.
I would expect a ClassCastException because one of your previous
messages suggested that 'priorityElements' is a multi-valued attribute.
This means that its value is an EList, not a TypedElement.
Cheers,
Christian
On 2013-03-21 08:57:44 +0000, Mariem Makni said:
> Hi Christian,
>
> I tried to use org.eclipse.uml2.uml.Element::getValue(Stereotype,
> String) method to get the value of The attribute of a stereotype
> "SwSchedulableResource" application but It doesn't works.
>
> Stereotype appliedStereotype =
> p.getImportedPackage().getAppliedStereotype("MARTE::MARTE_DesignModel::SRM::SW_Concurrency::SwSchedulableResource");
>
> if (appliedStereotype != null) {
> TypedElement priorityElements = (TypedElement) p
> .getImportedPackage().getValue(appliedStereotype,"priorityElements");
>
> }
|
|
|
Powered by
FUDForum. Page generated in 0.03073 seconds