Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » new Problem on applieng a StereoType
new Problem on applieng a StereoType [message #623751] Wed, 18 July 2007 11:56
Jan Reimann is currently offline Jan ReimannFriend
Messages: 90
Registered: July 2009
Hello NG, hello James ;)
at first I want to congratulate James for his "upgrade" ;)
Well, here is my problem. I have two methods. One is creating a Package
with some classes and the other creates a Package with some stereotypes.
Now I want to apply a StereoType to a Class after creating both
Packages. I tried it as follows:

Package classes = createClassDiagramPackage();
Class classA = getElementByName(Class.class, classes, CLASS_A_NAME);
Package stereoTypes = createStereoTypePackage();
Stereotype st = getElementByName(Stereotype.class, stereoTypes,

But all I get is IllegalArgumentException when applieng the StereoType.
My method getElementByName looks like this:

public static <T extends NamedElement> T getElementByName(
java.lang.Class<T> klasse, Package owningPackage, String name) {
EList<Element> elements = owningPackage.allOwnedElements();
for (Element element : elements) {
if (klasse.isInstance(element)) {
String tempName = ((NamedElement)element).getName();
if (tempName.equals(name)) {
return klasse.cast(element);
return null;

This method works fine - that means I don't get null as result. So why
can't I apply the StereoType?

Previous Topic:reuse the primitiveTypes package
Next Topic:How to check two models against each other
Goto Forum:

Current Time: Fri Jun 05 20:31:45 GMT 2020

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

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

Back to the top