Search code examples
parse-platformlocal-datastoreparse-android-sdk

How to pin/unpin ParseObject non recursive?


In my new android app based on parse, I would prefer pinning all sub-elements myself / not automatically, as pinning a certain sub-element would result in infinite recursion or just does not make sens in my context. Is there a way to pin and unpin an object not recursively?

I am already able to pin an object not recursively, but it is not such a pretty way:

Method m = ParseObject.class.getDeclaredMethod("pinInBackground", String.class, boolean.class);
m.setAccessible(true);
Object object = m.invoke(parseobject, pintag, false);
if(object instanceof Task) {
   Task task = (Task) object;
   return task;
}

Is there any normal way to achieve this? And is it somehow possible to unpin an object without this recursion mentioned in the Javadoc?

Removes the object and every object it points to in the local datastore, recursively.

Solution

  • As there is apparently at the time no solution for my problem implemented in the Parse-SDK-Android, I implemented some functions myself.

    Currently the pull request is still not merged. If someone needs a fast solution, feel free to use my branch:

    implementation 'com.github.thomax-it.Parse-SDK-Android:parse:1.21.1'