I have created and added a CollaborativeString to the Model with name 'SomeString'. Now I want to access the same object from the Model using model.getRoot().get('SomeString') and convert it to CollaborativeString and call one function of CollaborativeString class.

How can I convert the CollaborativeObject returned by the model.getRoot().get('SomeString') to CollaborativeString?

I saw CollaborativeString inherits CollaborativeObject, but I dont know how exactly to convert base class object to derived one.

Thanks in advance.

有帮助吗?

解决方案

The object returned by model.getRoot().get('SomeString') is already a CollaborativeString. You don't have to convert it. For example, if you want to append to the string, you could write

model.getRoot().get('SomeString').append('text to append');
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top