문제

I'm trying to get a package-object (get by id) from the repository of Enterprise Architect (Sparx Systems) and get the package name.

Here's a code snippet:

org.sparx.Package oPackage = null;
oPackage = repo.GetPackageByID(Integer.parseInt(packageID));
String sName = oPackage.Name; 

When I run my script, I get the following compilation error:

deleteExternalRef.java:44: error: cannot find symbol
               String sName = oPackage.Name;
                                      ^
 symbol:   variable Name
 location: variable oPackage of type Package
1 error 

Am I doing something wrong in the Java code or am I using the EA-API in a wrong way? I can use methods of the Package class. Only when I try to use the variables, I get this error.

도움이 되었습니까?

해결책

String sName = oPackage.Name;

you should use Sparx EA JAVA API (eaapi.jar), and your line will be following:

String sName = oPackage.GetName();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top