Passing Java objects?

Moderator: Moderators

Passing Java objects?

Postby bcole » Fri Jan 08, 2021 9:12 am

Good day all,

I'm playing around with trying to demonstrate snippets of Java code with Opaque Behaviors in the Simulation Toolkit. I would like to be able to pass Java objects on pins but untyped output pins only send Strings. Is there an appropriate Class or Block from a library to use to have the pin retain the in-memory Java object to pass to into the Opaque Behavior? Or must I convert fUML.Kernel.Object_ into the desired Java object with ALH type calls?

In the attached model, the intent is for the opaque action to have access to a runtime Java object rather than a String.

Thanks,

Bjorn
You do not have the required permissions to view the files attached to this post.
bcole
Forum Newbie
Forum Newbie
 
Posts: 21
Posts Rating:0
Joined: Sat Feb 10, 2018 8:03 am

Re: Passing Java objects?

Postby bcole » Sat Jan 09, 2021 8:15 am

I do want to note that I do have a somewhat clunky workaround be progressively serializing and deserializing these Java objects for different chunks of the code in my opaque behaviors using the Jackson API.
bcole
Forum Newbie
Forum Newbie
 
Posts: 21
Posts Rating:0
Joined: Sat Feb 10, 2018 8:03 am

Re: Passing Java objects?

Postby arnon_l » Mon Jan 11, 2021 8:01 am

Hello,

Values that could be passed on pins must be fUML values (based on fUML standard to execute UML Activity).

The sample of fUML values are:
- fUML.Semantics.Classes.Kernel.Object_ to store fUML object
- fUML.Semantics.Classes.Kernel.StringValue to store String value
- fUML.Semantics.Classes.Kernel.ElementValue to store UML element value
- and etc.

Unfortunately, there is no fUML values for Java object.
So using Java Serialization and Deserialization as you did would be a possible workaround(but not convenient) to pass Java object on pins.

Sincerely,
arnon_l
Customer Support
Customer Support
 
Posts: 82
Posts Rating:10
Joined: Thu Aug 30, 2012 3:39 am

Re: Passing Java objects?

Postby bcole » Tue Jan 12, 2021 7:26 am

Thanks for the rapid reply. I appreciate it. The serialization / deserialization works okay in this use case which is enhancing the visibility of code block tests so I'm okay with this answer.
bcole
Forum Newbie
Forum Newbie
 
Posts: 21
Posts Rating:0
Joined: Sat Feb 10, 2018 8:03 am


Return to Cameo Simulation Toolkits

Who is online

Users browsing this forum: No registered users and 1 guest

cron