How to Override a Method in a Behavior via Open API?

Hi - it's me again,

First up, my overall aim is to create concepts, editors, behaviors, etc... via Java. Is there a snippet of code, I could check out so I won't have to bother you with these small but - nevertheless - annoying problems?

I finally managed to create a behavior with constructor and methods. Now I got stuck while trying to override a method, because it's not quite clear for me, how to get a reference to a ConceptMethodDeclaration . In this case i'd like to override BaseConcept.getPresentation .

// create the needed methods: 
node<ConceptMethodDeclaration> mth_presentation = new node<ConceptMethodDeclaration>(); 
mth_presentation.returnType.set new(StringType); 
mth_presentation.name = "getPresentation"; 
mth_presentation.visibility.set new(PublicVisibility);
  ⋮
mth_presentation.overriddenMethod.set(concept/BaseConcept/.); ???
prettyPrint();
What do I have to do, in order to add a overriddenMethod ?


Thanks in advance!

Cheers,
Dennis
2 comments
Would picking from this collection work, perhaps with a findFirst()?
nlist<ConceptMethodDeclaration> availableConceptMethods = declaration.getAvailableConceptMethods(declaration);
prettyPrint();

Vaclav
0
Thanks again Vaclav, for your quick and very helpful reply!!
0

Please sign in to leave a comment.