Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » test an integer property
test an integer property [message #491974] Fri, 16 October 2009 20:35 Go to next message
--alex--  is currently offline --alex-- Friend
Messages: 26
Registered: October 2009
Junior Member
Hi all,
I've problems in getting the value of a property of an element. The property has type PrimitiveType (actually PrimitiveTypeImpl) which has "integer" as its name.

I wrote the code to access that property but I can't find a way to get its value. I tried "getValue(stereotype, propertyName)" but no stereotype I have makes the call successful. I have tried everything I've found in the UML API with no success.
I know the following code drives me in the right direction as I traced in the eclipse debug.

Here is my code:
...
Element objectselected = (Element) sel.getFirstElement();
for (Stereotype strt : objectselected.getAppliedStereotypes()) {
  if (!strt.getOwnedRules().isEmpty()) {
    if (strt.getName().equals("RequiredOperation")) {
    for (Property p : strt.getOwnedAttributes()) {
    if (p.getName().equals("invocations")) {
      if (p.GETVALUE()>0 /*test non-negativity of the integer value of invocations*/) {
      }
    }
....

what can I write to replace GETVALUE()?

[Updated on: Fri, 16 October 2009 20:37]

Report message to a moderator

Re: test an integer property [message #492152 is a reply to message #491974] Mon, 19 October 2009 07:35 Go to previous message
--alex--  is currently offline --alex-- Friend
Messages: 26
Registered: October 2009
Junior Member
Ok, I solved my problem using getvalue() at the element level, not at the property level!

Sorry for the question, it's just I've to get used to this uml framework!
Previous Topic:drawing sequence diagram
Next Topic:test an integer property
Goto Forum:
  


Current Time: Thu Nov 27 17:33:56 GMT 2014

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

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