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
Member
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,
STEREOTYPE_TEST);
classA.applyStereotype(st);



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?


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


Current Time: Tue Nov 21 16:01:11 GMT 2017

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

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