Page 1 of 1

2021x StereotypesHelper refactor

PostPosted: Mon Sep 27, 2021 12:18 pm
The collectOwnedSlots() method was removed from the StereotypesHelper class in the 2021x release. Does anyone know the new, preferred way to obtain the Slot elements from a com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class object?

Re: 2021x StereotypesHelper refactor

PostPosted: Wed Nov 10, 2021 2:12 am

I'm trying to migrate to 2021x as well and I'm having the same issues with the Class StereotypesHelper; they're not exactly the same methods (mine are getSlot(), addSlotValue(), hasStereotypeByName()), but the same issue. Does anyone know how to solve the problem?

Re: 2021x StereotypesHelper refactor

PostPosted: Tue Jun 21, 2022 3:33 am
by ogirdor

I am not sure if this is the most straight-forward way, but I do it like this (in java):

Code: Select all
.filter(o -> o instanceof TaggedValue)
.filter(t -> ((TaggedValue) t).getTagDefinition().getName().equals("slotName"))
.map(t -> (String)(((TaggedValue) t).getValue().get(0)))