I am creating a custom event handler. When I override the handleEvent method I need to return a java.util.map object. However, my code is retrieving the data using the class type.
Option option = Backendless.Data.of(Option.class).findById(optionObjectId);
How can I convert the option object to a java.util.map so that I can return it from the handleEvent method? Does backendless have any built in functionality to do this conversion? Or, do I need to manually create a map object so that I can return it?
Hi David,
Backendless can already do it for you. Here’s how:
HashMap optionMap = Backendless.Data.of( "Option" ).findById( optionObjectId );
The primary difference is the of() method. If you pass your table name as a string, then you can work with your table through hashmaps rather than entity classes.
Regards,
Mark
But that call doesn’t seem to query the relationships of “Option”.
Neither does the call you showed in your original post… ))
There is a method override which lets you provide a collection of relations:https://github.com/Backendless/Android-SDK/blob/master/src/com/backendless/IDataStore.java#L71