All of my backendless objects subclass an Entity class that contains all of the common backendless properties (objectId, ownerId, create, update, __meta, etc.) except for the ___class property… I have to put the ___class property in each of the subclasses. It’s easy enough to for a super class to generate that string value for it’s subclasses, but the client side actionscript API uses the hasOwnProperty("___class") method which isn’t able to see properties in inherited classes.
It would be cool if that was changed to allow for ___class in inherited classes
Thanks!
No, that would not be cool at all… )) The __class property is handled the same way as the name of the class obtained through reflection. Moving __class to the parent class would violate the OOP principle we follow in order to derive the name of the serialized class.
There is a way to avoid that property altogether (meaning you do not need to add it to the class). All you need to do is to declare your classes as “dynamic”.
Regards,
Mark
Ok, I guess I never understood what that property was for anyway. Is so that an object’s class name can be different than the database table name or something?
No, it is there to determine which table an object should be written to.
Please provide JAVA example of this:
“All you need to do is to declare your classes as “dynamic”.”
“dynamic” classes is something specific to ActionScript, I cannot think of anything similar in Java.
What problem are you trying to solve?
I have seen several reference to “__class property” in the support but I could not find it in the JAVA API documentation.
When and how do you use?
Thanks
In most of the cases you should not need it. The property is used with the dictionary-based approach, specifically with in the related objects to identify the table where they should be created or updated.