Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Papyrus for Real Time » Getting Parts of a capsule (some type casting issue)
Getting Parts of a capsule (some type casting issue) [message #1744865] Fri, 30 September 2016 21:38 Go to next message
reza ahmadi is currently offline reza ahmadiFriend
Messages: 47
Registered: September 2016
Member
Hi,

I need to get Parts of a Capsule object (which is of type Class). I am basically working with org.eclipse.uml2.uml objects. Here is my code:

public static List<Property> getCapsuleParts(Class capsule){
for (Property part: capsule.getParts()){
// I want part object being of type Class rather than Property.

}
}

What I need is to have part object being of type Class rather than Property. Of course each part is a property, but there must be a way to cast (or convert) a Property object to a Class one.

I am working on a Papyrus-RT plugin, but I think this is not Papyrus-RT related though.

Any idea is appreciated.
Re: Getting Parts of a capsule (some type casting issue) [message #1744866 is a reply to message #1744865] Fri, 30 September 2016 21:47 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi,

A property has a type and that type may be a class. If it is a class, then the CapsuleUtils::isCapsule API can tell you whether that class is a capsule. If so, then the property is a capsule-part. Otherwise, it may be an attribute of primitive or passive class type, or even a port.

HTH,

Christian
Re: Getting Parts of a capsule (some type casting issue) [message #1744969 is a reply to message #1744866] Mon, 03 October 2016 14:35 Go to previous message
reza ahmadi is currently offline reza ahmadiFriend
Messages: 47
Registered: September 2016
Member
Yes, that was very helpful! thanks!
Previous Topic:UML2 class of a capsule
Next Topic:Papyrus-RT 0.8 is available!
Goto Forum:
  


Current Time: Thu Apr 25 13:12:54 GMT 2024

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

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

Back to the top