Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: bITs.EA on January 03, 2014, 12:51:36 am
-
Hi,
I'm trying to get a package-object from the repository (get by id) 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 compile error
deleteExternalRef.java:44: error: cannot find symbol
String sName = oPackage.Name;
^
symbol: variable Name
location: variable oPackage of type Package
1 error
...Run
What am I doing wrong???
-
Problem solved: I had to use a method "package.GetName()" instead of a variable "package.Name".
I guess I'm using an old user guide or the user guide isn't up-to-date...
-
I think VB and C# use real properties, so you can indeed write
mystring = oPackage.Name or
oPackage.Name = mystringwhereas Java uses getter and setter methods.
So in Java that would be
myString = oPackage.GetName()or
oPackage.SetName(myString)
Geert
-
Thanks for the additional info!
Greets