Support Topics Documentation Slack YouTube Blog

Help on RetrieveData retrieveData = RetrieveData.getInstance()

How to use the RetrieveData.getInstance(); of a List instead of Object ?
I have created a codeless API name getAllDataFromPersonTable,
when I do: retrieveData.getAllDataFromPersonTableAsync(new AsyncCallback()
since my logic in Codeless creates a List it needs to be an AsyncCallback <List> instead of an object.
So I thought, let’s cast the List to Object with: Object [] result = (Object []) response;
But that does not work as I get: java.util.ArrayList cannot be cast to java.lang.Object[]

RetrieveData retrieveData = RetrieveData.getInstance();

    retrieveData.getAllDataFromPersonTableAsync(new AsyncCallback<Object>() {
        @Override
        public void handleResponse(Object response) {

            Object [] result = (Object []) response;
            List<Object> people = Arrays.asList(result);

‘com.backendless:backendless:5.3.0’

Can you help me out on this one?

Application ID
9899A2F8-3DC6-5C94-FF20-89FD58136300

Hi Robin,

Try to do this:

  1. Click the “edit” icon for your method:
    API Services - BL - TooLooT - Backendless 2020-06-27 10-40-24
  2. In the edit popup, specify the return type of the method:
  3. Since your method returns a collection of Person objects, make the following selections:
  4. Once it is done, save the method by clicking the SAVE button.
  5. Re-download the generated client-sdk. Now the generated SDK should have proper return type.

The reason you need to do that, is the code generator doesn’t know what the formal return type is and it cannot make a guess.

Regards,
Mark

1 Like