Does Android SDK provide API for converting HashMap to custom object?

Does Android SDK provide API for converting HashMap to custom object?

Well, basically there is no such API. Can you describe your case?

For example i have BackendlessUser object and there is one-many relation with object[].

I want to cast them to List<CustomClass>, how to achieve this ?

you should add
Backendless.Data.mapTableToClass(“TableName”, CustomClass.class );

here it is simple example:

Backendless.initApp("app-id", "key", "v1");

Backendless.Data.mapTableToClass("Person", Person.class );

BackendlessUser user = Backendless.Data.of(BackendlessUser.class).findFirst();


Yeah I mean for other classes than BackendlessUser.class it might work, but I asked specifically about that particular class.

So in your code you suggested to map data, so ok line will look as:
Backendless.Data.mapTableToClass(“Users”, Users.class );

But then obviously this line:
BackendlessUser user = Backendless.Data.of(BackendlessUser.class).findFirst();

Does not make any sense, you need to pass User.class not BackendlessUser to get mapping, but on the other hand, this is not something I wanted, because User.class cannot extend BackendlessUser.class therefore you cannot for example pass User.class to Backendless.UserService.setCurrentUser.

So back to question -> how to map BackendlessUser.class to java object instead of using hashmap -> especially in terms of related objects!

You cannot map Users table to any other class than BackendlessUser.

exactly, which leads are back to question! How to access related data from BackendlessUser object in Object form, nor Hashmap ?

If you call mapTableToClass for the related object’s class, BackendlessUser’s related objects then should contain objects of that class instead of HashMap.