The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
[SOLVED]How to check the input Object Type?
Hello,
-I have two output ports which contents "obj1 (obj1.class), obj2 (obj2.class)" for each as the release object.
-I have one input prot.
-What I want is checking the input object type when I get the Data form whatever which output port released.
obj1(output) \
------- input port
obj2(output) /
I thought I can do like:
I have to use "input.get(Obj1.class)" or"input.get(Obj2.class)"
If I do so, I think the way what I just proposed won't be work.
Could you help me?
Thanks
Jiang
-I have two output ports which contents "obj1 (obj1.class), obj2 (obj2.class)" for each as the release object.
-I have one input prot.
-What I want is checking the input object type when I get the Data form whatever which output port released.
obj1(output) \
------- input port
obj2(output) /
I thought I can do like:
But the "getData()" method was deprecated
if(input.getData() instancof Obj1)
do ....
I have to use "input.get(Obj1.class)" or"input.get(Obj2.class)"
If I do so, I think the way what I just proposed won't be work.
Could you help me?
Thanks
Jiang
Tagged:
0
Answers
you can call "getAnyDataOrNull()" on the input port. You can then check what you got and deliver it to the desired output port.
Regards,
Marco