In the new 3.5 SDK there are new functions under URCapProgramNode called canGetAs and getAs.
I tried using the canGetAs function on my newly created node to cast to the node’s service, contribution, as well as to a custom interface, that I created, that is implemented by the node’s contribution.and service. Every time it returns false. In the new sdk package there is no sample program on how to use this. Can you please show an example of how to use this functionality?
I also found that canGetAs always returned false. However, getAs(MyCustomInterface) seems to work, and I can then cast this to a Contribution class to call whatever methods I want. You obviously need to put this in a try-catch block since getAs(MyCustomInterface) will throw an exception for nodes that don’t implement the interface.
have you ever tried to save the program with this node and then load the program? when it creates again the Tree after loading, I get a TreeStructureException, message “Parent node not in a tree.” when I call the GetAs: