Question

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.

Was it helpful?

Solution

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');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top