Please consider registering

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
codegen duplicate method
October 13, 2020
15:38, EEST
New Member
Forum Posts: 2
Member Since:
October 9, 2020
sp_UserOfflineSmall Offline


I generated java sources with codegen and imported them in my project. Some of the files generated have several declaration for the same methods. Where should I change this? Is it coming from the models in input of the generator? What is the best way to address this? Thank you in advance.

October 13, 2020
16:35, EEST
Bjarne Boström
Forum Posts: 559
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline


An example of the output code would help/clarify, but yes it comes from the models (unless I misunderstood something here)

See the codegen manual section 4.5.4 “Excluding sub-nodes under a Type node from generation”. The quote below is that section (though note that since it is XML, it is best to read it from the manual since this forum is not exactly best suited to display it):

4.5.4. Excluding sub-nodes under a Type node from generation

Some models might result in generated code that conflicts the base API the SDK provides with UaNodes or name clashes because of one or more models, and thus might not compile. Currently the only workaround (outside of editing the model itself) is to exclude those nodes when generating get/set/getXXXNode methods for the type. An excluded sub-node behaves in the context of the generation as-if it were never present in the Type under which it is.

In the both versions they can be excluded:


For example, in order to exclude the PowerInput subnode (that is used in ValveObjectType in the SampleTypes model), you would use the following configuration:


NOTE: Excluding a component does not remove it from the AddressSpace of the server, it just means that the generated accessor for it wont be available. The equivalent operation can be done “manually” by getting the component node (UaNode.getComponent) and reading/writing values to that directly. Excluded Methods do not create the handling logic, and must be done via a listener (see MyMethodManagerListener in the samples).

NOTE: Currently the exclude excludes it from all types, as the main use case is to avoid name clashes with the SDK core API.

I would also doublecheck for any modeling errors just in case. It should also be noted that generated code doesn’t care about namespaces (so this can happen if you used the same component name from a different namespace). However this could also happen if you made 2 subnodes that have the completely same BrowseName (including the namespaceindex in the QualifiedName value), that is however not allowed in OPC UA (in types part of the address space, and instance can have more than one sub-node with the same exact BrowseName): https://reference.opcfoundation.org/v104/Core/docs/Part3/6.2.5/.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 267

Currently Online:
13 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 103

pramanj: 86

ibrahim: 70

kapsl: 57

gjevremovic: 49

TimK: 41

Fransua33: 39

fred: 38

Rainer Versteeg: 32

Thomas Reuther: 31

Member Stats:

Guest Posters: 0

Members: 1118

Moderators: 14

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1034

Posts: 4352

Newest Members:

aldayr, Python techie, emanuel45q, Patrick, sammycontrols, hellema, linoy, subranna, ray, richN9177

Moderators: Jouni Aro: 853, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 559, Heikki Tahvanainen: 402, Jukka Asikainen: 1, Teppo Uimonen: 21, Markus Johansson: 24, Matti Siponen: 64, Lusetti: 0

Administrators: admin: 1